PHP feof() Function

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.

bool feof ( resource $handle )

Tests for end-of-file on a file pointer.

Example -

ParameterDescription
fileRequired. Specifies the open file to check

Warning -

If the passed file pointer is not valid you may get an infinite loop, because feof() fails to return TRUE.

Example -