1. Computing

Discuss in my forum

Feof PHP Function

By , About.com Guide

Definition: The feof () PHP Function is used to test for the end of a file. It is often used in a loop, to keep a process going until everything in the document has been processed. It is phrased as: feof($file) but more often seen as !feof($file).
Examples:
 <?php 
 $myFile = "YourFile.txt"; 
 $handle = fopen($myFile, 'r'); 
 while (!feof($handle)) 
 { 
 $data = fgets($handle, 512); 
 echo $data; 
 echo "<br>"; 
 } 
 fclose($handle); 
 ?>
This returns the data from the file as long as feof () is not true. When it is true (you have reached the end of the file) then the loop is exited.
Related Video
Basic PHP Syntax
Using PHP With HTML
Top Related Searches feof echo data myfile yourfile lt br
  1. About.com
  2. Computing
  3. PHP / MySQL
  4. PHP Functions
  5. PHP Feof - PHP end of file - Feof php function

©2013 About.com. All rights reserved.