$feof
From Scriptwiki
Indicates the end of file was reached.
$feof
Return the results of the last file access attempt in any script.
Example
Let's imagine we have the following example file moo.txt in our mircdir:
one two three
; at first we have to open the file. /fopen moo moo.txt ; let's jump to the third line. /fseek -l moo 3 ; and now read this line so that the pointer is set to the end of the line. echo -a $fread(moo) ; finally, we want to echo $feof and see, what it returns. echo -a $feof ; this will return 1 as we are at the end of our file. ; never forget to close the file fclose moo
; we can use this identifier to loop through a file, too fopen moo moo.txt ; as long as $feof returns 0, this while loop will read the next line while (!$feof) { ; echo the line where the pointer is. The pointer will automatically moved to the next line . echo -a $fread(moo) ; that's why we do not need to increase a variable, as you normally would have to do. } ; close the file. fclose moo