How To Read the Entire File into a Single String PHP ?

1 replies
If you have a file, and you want to read the entire file into a single string. You can use the file_get_contents() function.

It opens the specified file, reads all characters in the file, and returns them in a single string.

Simple PHP Example:


$file = file_get_contents("-------------------------------"); ------>>>>> Source of the file

print("Size of the file: ".strlen($file)."\n");


This command will return a value with no of characters in particular file for example 10,000 .
#entire #file #php #read #single #string

Trending Topics