feof

Started by chinmay.sahoo, 12-24-2015, 00:43:06

Previous topic - Next topic

chinmay.sahooTopic starter

The feof function tests for end-of-file on a file pointer and takes a filename as argument. It's used mostly in a while loop to perform the same function on each line in a file:

Quotewhile (!feof($fd)) {
$line = fgets($fd, 4096);
echo $line;
}


TomClarke

 The feof function checks if the "end-of-file" (EOF) has been reached.
This function returns TRUE if an error occurs, or if EOF has been reached. Otherwise it returns FALSE.