- Data Structure
- Networking
- RDBMS
- Operating System
- Java
- MS Excel
- iOS
- HTML
- CSS
- Android
- Python
- C Programming
- C++
- C#
- MongoDB
- MySQL
- Javascript
- PHP
- Physics
- Chemistry
- Biology
- Mathematics
- English
- Economics
- Psychology
- Social Studies
- Fashion Studies
- Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
feof() function in PHP
The feof() function tests for end-of-file on a file pointer. It returns TRUE if the file pointer is at EOF or an error occurs (including socket timeout); otherwise returns FALSE.
Syntax
feo(file_pointer)
Parameters
file_pointer − 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
The feof() function returns TRUE if the file pointer is at EOF or an error occurs, otherwise returns FALSE.
Example
<?php $file_pointer = @fopen("/myfiles/one.php", "r"); if ($file_pointer) { while (!feof($file_pointer)) { $buffer = fgetss($file_pointer, 1024); echo $buffer; } fclose($file_pointer); } ?>
Output
First line
Advertisements