What is the use of file in php?
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);
?>
which prints
Array
(
[0] => Hello
[1] => This
[2] => Is
[3] => My
[4] => File
)
Comment on this Question and Answer >>>
ASK A QUESTION
More files PHP Questions
Getting first five lines from a fileWould like to create a web page by using the contents of file#1 as input, writing contents of a variable as content, and ending with contents of file#2. Would you please help me learn how to do this? Here is my attempt: $in1 = 'input1.html'; $in2 =
Where is a text file i created kept?
What does file_get_contents do?
How can i upload large files like mp3 songs using php?
