php feof function_PHP tutorial

WBOY
Release: 2016-07-20 11:00:51
Original
985 people have browsed it

The following is a tutorial specifically about feof, including implementation. ​

The following is a tutorial specifically about feof, including implementation.

feof
(PHP 4, PHP 5)

feof - the file pointer to the end of the test file

Description
boolean feof(resource$handle)
Pointer to the archive file at the end of the test.

Parameters

Handle
The file pointer must be valid and must point to a file successfully opened by fopen() or fsockopen() (and not yet closed by fclose()).


Return value
Returns TRUE if the file pointer is EOF analyzed or an error occurred (including socket timeout), otherwise returns FALSE.

Note
Warning
If a connection opened by fsockopen() does not close the server, feof() will wait until the timeout has been reached and return the value TRUE. The default timeout value is 60 seconds. You can use stream_set_timeout() to change this value.

Warning
If the file pointer passed is invalid, you will get an infinite loop because feof() does not return TRUE.

Look at the example:

// if file can not be read or doesn't exist fopen function returns FALSE
$file = @fopen("no_such_file", "r");

// FALSE from fopen will issue warning and result in infinite loop here
while (!feof($file)) {
}

fclose($file);
?>


www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/445485.htmlTechArticleThe following is a tutorial specifically about feof, with implementation, etc. The following is a tutorial specifically about feof, including implementation. feof (PHP 4, PHP 5) feof - test file end of file refers to...
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!