Description:
The fgets() function is used to read a single line from a file.
After a call to this function the file pointer has moved to the next line..
The code below reads a file line by line until the end of file is reached..
Code:
<?php
$file =fopen("file1.txt","r") or exit("unable to open file!");
while(!feof($file))
{
echo fgets($file)."<br />";
}
?>
Output:
The fgets() function is used to read a single line from a file.
After a call to this function the file pointer has moved to the next line..
The code below reads a file line by line until the end of file is reached..
Code:
<?php
$file =fopen("file1.txt","r") or exit("unable to open file!");
while(!feof($file))
{
echo fgets($file)."<br />";
}
?>
Output:
No comments:
Post a Comment