Using fgets() and feof() Functions : File Read « File Directory « PHP






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";
  }
?>

           
       








Related examples in the same category

1.Reading a Specific Character
2.Reading Specific Data from a File
3.Reading from a File
4.Opening and Reading a File Line by Line
5.Reading a File with fread()
6.File read by char