On page 131, the fwrite() function has a TIP that reads:
To read the entire file into a string, use the function filesize().
// file.txt contains the sentence: Hello World! $filename = 'file.txt'; $file = fopen($filename, 'r'); $string = fread( $file, filesize($filename) ); var_dump($string); // file.txt now contains at the end: Hello World! |
You’ll notice that this is the same tip as fread() and doesn’t belong. It should be considered ‘removed’.