Php feof function

Source: Internet
Author: User

Feof
(PHP 4 and PHP 5)

Feof-pointer to the end of the test file

Description
Boolean feof (resource $ processing)
File pointer at the end of the test.

Parameters

Handle
The file pointer must be valid and must point to a file that successfully opens fopen () or fsockopen () (and has not closed fclose ()).


Return value
Returns TRUE. If the file pointer is EOF analysis or an error occurs (including socket timeout), otherwise, FALSE is returned.

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

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

Look at the instance:

<? Php
// 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 );
?>

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.