Forum : What is the use of file in php?
Brief description  about Online courses   join in Online courses
View Manju  S Reddy 's Profile

What is the use of file in php?

What is the use of file in php????
Asked by Manju S Reddy | Mar 17, 2010 |  Reply now
Replies (1)
View teacher siliconindia 's Profile
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);
?>
Mar 17, 2010