Search
 
SCRIPT & CODE EXAMPLE
 

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
Comment

PREVIOUS NEXT
Code Example
Php :: laravel eloquent soft delete 
Php :: model get last query in php 
Php :: preg_replace 
Php :: how to change php version in cpanel 
Php :: laravel wherein example 
Php :: tableau aléatoire php 
Php :: Reset Admin password in Magento 2 
Php :: laravel find by field 
Php :: php rand vs mt_rand 
Php :: how to convert unix timestamp to date php 
Php :: laravel form request validation unique update 
Php :: excerpt more wordpress 
Php :: Add WooCommerce Price Suffix 
Php :: php html to text 
Php :: php set http status header 
Php :: add execute time php 
Php :: transfer file using file_get_content 
Php :: PHP min() and max() 
Php :: how to clear session in laravel 
Php :: php object 
Php :: php formData curl 
Php :: php example 
Php :: ckeditor laravel 
Php :: get post by meta value 
Php :: wordpress create shortcode 
Php :: notify multiple users laravel 
Php :: codeigniter installation with composer 
Php :: Get all Country List using php 
Php :: root composer.json requires php ^7.3 but your php version (8.0.3) does not satisfy that requirement. 
Php :: php implode 
ADD CONTENT
Topic
Content
Source link
Name
3+7 =