(PHP 4, PHP 5)
FeOF - Test the file pointer to the end of the file
If the server does not turn off the connection opened by fsockopen (), Feof () will wait until the timeout returns TRUE. The default timeout limit is 60 seconds, you can use stream_set_timeout () to change this value.
The file pointer must be valid, and must point to files that have been successfully opened by fopen () or fsockink () (and not yet fed from fclose ()).
If the passed file pointer is invalid, it may fall into an infinite loop because EOF will not return true.
EXAMPLE # 1 example of FeOF () using invalid file pointers
php // If the file is not read or does not exist, the FOPEN function returns false $ file = @fopen ("no_such_file", "r"); // False from FOPEN issues a warning message and falls here in an unlimited loop While (! Feof) {} fclose ($ file);?>
example
PHP
$ file = fopen ($ _ server ['Document_Root']. "/ me / test.txt", "r");
// Output all rows in the text until the file ends.
While (! Feof ($ file))
{
Echo fgets ($ file). "
}
Fclose ($ file);
?>
Output:
Hello, this is a test file.
There is three.
This is the last line.