The example of feof() Function in the PHP programming language.
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