Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PHP

php read text file into array

//php read a text file into an array
//each item in the array is a line in the text file
//file.txt looks like this:
//hello
//testing
//text
//end file.txt (the file doesn't include the // marks
$file = file("http://example.com/file/file.txt");
echo $file[0]; //prints hello
echo $file[1]; //prints testing
echo $file[2]; //prints text
 
PREVIOUS NEXT
Tagged: #php #read #text #file #array
ADD COMMENT
Topic
Name
8+2 =