Open the file and read lines until the end-of-file (EOF) is reached.
<?php $file = fopen(“test.txt”, “r”); //Output lines until EOF is reached while(! feof($file)) { $line = fgets($file); echo $line. “<br>”; } fclose($file); ?> |
The feof()
function determines if the end-of-file (EOF) has been reached for an open file.
Tip: This function is helpful for iterating through data of unknown length.
feof(file) |
Parameter |
Description |
file |
Mandatory. Specifies an open file to check. |
Return Value: |
Returns |
PHP Version: |
4.0+ |