PHP feof function _php Tutorial

Source: Internet
Author: User
Below is a special narrated feof tutorial, there are implementations and so on.

Below is a special narrated feof tutorial, there are implementations and so on.

Feof
(PHP 4, PHP 5)

feof-file pointer to end of test file

Describe
Boolean feof (resource $ processing)
The file pointer at the end of the test.

Parameters

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


return value
Returns true if the file pointer is EOF parsed or an error occurred (including a socket timeout), otherwise false is returned.

Note
Warning
If a connection is opened Fsockopen () does not shut down the server, feof () will wait until the timeout has reached the return value of true. The default timeout value is 60 seconds. You can use Stream_set_timeout () to change this value.

Warning
If the pass file pointer is not valid, you will get an infinite loop because feof () does not return a value of true.

See Example:

If file can not be read or doesn ' t exist fopen function returns FALSE
$file = @fopen ("No_such_file", "R");

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

Fclose ($file);
?>


http://www.bkjia.com/PHPjc/445485.html www.bkjia.com true http://www.bkjia.com/PHPjc/445485.html techarticle Below is a special narrated feof tutorial, there are implementations and so on. Below is a special narrated feof tutorial, there are implementations and so on. Feof (PHP 4, PHP 5) feof-test file End file refers to ...

  • 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.