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
If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.
Ask your questions, our development team will try to give answers to your questions.