Example -
In php we can read the files just like c.
Code and Syntax –
<?php
$file = fopen("myfile.txt", "r") or
exit(“error !");
while(!feof($file))
{
echo fgets($file).
"<br>";
}
fclose($file);
?>
Explanation
–
In above program, we have used fopen method to
open a file and fgets is used to read one line of file at a time. Feof is used to
find the end of file.
For more php questions and answers, dumps,
tutorials for beginners and experienced people visit http://www.top-php-interview-questions.blogspot.in If you find any errors while executing this
program, you can make your comments or mail me at reply2sagar@gmail.com
No comments:
Post a Comment