Mega Code Archive

 
Categories / Php / File Directory
 

Using fgets() and feof() Functions

<?php   $myfile = "./test.txt";   $openfile = fopen ($myfile, "r") or die ("Couldn't open the file");   while (!feof ($openfile)) {      $lines= fgets($openfile, 1024);      echo "$lines", "\n";   } ?>