Discussion board
What is the use of file in php?
By Manju S Reddy
What is the use of file in php????
Reply
Post   Reset
Teacher SiliconIndia replied to Manju S Reddy Wednesday, March 17, 2010
Hi Manjunath,
The file function returns the contents of a file as an array, with one line per element in the array.
For instance, if I have a file that contains this:
Hello
This
Is
My
File
Then this is how the file function returns it:
<?php
$contents = file("myfile.txt");
print_r($contents);
?>