Home Tutorial Php Phpfiles feof() Function in php

 
 

Share on Google+Share on Google+
feof() Function in php
Posted on: September 21, 2009 at 12:00 AM
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

 

Advertisement

Related Tags for feof() Function in php:


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.

Posted on: September 21, 2009

Recommend the tutorial

Advertisements Advertisements
 

 

 

DMCA.com