PHP Learning : Line by Line fgets() function - Publik Talk

Breaking

An informative website for every one.

Post Top Ad

Post Top Ad

Wednesday, August 2, 2017

PHP Learning : Line by Line fgets() function

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:





No comments:

Post a Comment

Post Top Ad