Open and Format Text Document
5
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-----//
?>






I've got good news, and I've got bad news:
The universe is merely a figment of my imagination.
Now are you ready for the bad news?