Open and Format Text Document





5
Date Submitted Sun. Oct. 22nd, 2006 5:21 AM
Revision 1 of 1
Beginner kiefpiet
Tags PHP
Comments 1 comments
Open a text file and format it (word wrap).

<?php
//-----Open File-----//
   $str = "/ . /";
   $count =0;
 
  $file = fopen ("$dir_name/$thisName","rw") ;
  while (!feof ($file)) {
     $buffer = fgets($file, 4096);
          if(preg_match($str, $buffer)){
               $count = $count +1;
               
               };
               
               if($count > $count - 10){
               echo $buffer;
               echo "<br>";
               $count = $count +10;
               };          
  };
 fclose($file);
 $buffer="";
//-----Closed File-----//
?>
 

kief piet

Comments

Comments Congratulations!
Thu. Nov. 2nd, 2006 1:11 PM    Scripter sehrgut

Voting