Share on Google+Share on Google+

feof() Function in php

Advertisement
The example of feof() Function in the PHP programming language.

Examples of the feof() function in PHP

Syntax on feof() function in PHP

bool feof ( $file_pointer )

It is used for checking the end of file of  the  file pointer returned by fopen() and fsockopen()

It is used with loops to show the content of the file line by line by the functions fgets()

It returns false if the file pointer has not reached to the end of file. So the loop will continue.

It returns true if the file pointer  is reached to the end and then the loop will terminate

Code for feof() function in PHP

<?php

$file1=fopen("c:/rose1/ram.txt","r");

do

{

$line=fgets($file1);

echo $line;

echo "<br/>";

}

while(!feof($file1))

?>

Output

welcome to roseindia
welcome to roseindia
welcome to roseindia
welcome to roseindia
welcome to roseindia
welcome to roseindia

 

Advertisements

Advertisement

Posted on: September 21, 2009 If you enjoyed this post then why not add us on Google+? Add us to your Circles

Share this Tutorial Follow us on Twitter, or add us on Facebook or Google Plus to keep you updated with the recent trends of Java and other open source platforms.