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.
How To Read the Entire File into a Single String PHP ?
1
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:
<?php
$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 .
It opens the specified file, reads all characters in the file, and returns them in a single string.
Simple PHP Example:
<?php
$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 .
- wordpress+expert
Next Topics on Trending Feed
-
1