Home  >  Article  >  Backend Development  >  php feof function_PHP tutorial

php feof function_PHP tutorial

WBOY
WBOYOriginal
2016-07-20 11:01:291006browse

Returns TRUE if the file pointer reaches EOF or an error occurs, otherwise returns an error (including socket timeout), otherwise returns FALSE. ​

Definition and usage
The feof() function detects whether the end of file (eof) has been reached.

Returns true if the file pointer reaches eof or an error occurs, otherwise returns an error (including socket timeout), otherwise returns false.

Grammar
feof(file) parameter description
file required. Specifies the open file to be checked.

Description
The file parameter is a file pointer. This file pointer must be valid and must point to a file that was successfully opened by fopen() or fsockopen() (but has not been closed by fclose()).


$fh = fopen("/home/www.bkjia.com/data/users.txt", "rt");
while (!feof($fh)) echo fgets($fh);
fclose($fh);
?>

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/445445.htmlTechArticleIf the file pointer reaches EOF or an error occurs, it returns TRUE, otherwise it returns an error (including socket timeout), in other cases Returns FALSE. Definition and usage feof() function detection is...
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn