Re: note 36263 rejected and deleted from function.file-get-contents by notes editor didou
| From: | Christian Stadler | Date: | Mon, 20 Oct 2003 10:56:22 +0000 |
| Subject: | Re: note 36263 rejected and deleted from function.file-get-contents by notes editor didou | ||
| References: | 1 | Groups: | php.mirrors |
| Request: | Send a blank email to php-mirrors+get-21583@lists.php.net to get a copy of this message | ||
webmaster@php.net wrote:
You are receiving this email because your note posted
to the on-line PHP manual has been removed by one of the editors.
[...]
----- Copy of your note below -----
Users of PHP4 < 4.3.0 can use the following:
It is binary safe and it can be used for external files.
<?php
if (!function_exists("file_get_contents")) {
function file_get_contents($filename, $use_include_path = 0) {
$data = ""; // just to be safe. Dunno, if this is really needed
$file = @fopen($filename, "rb", $use_include_path);
if ($file) {
while (!feof($file)) $data .= fread($file, 1024);
fclose($file);
}
return $data;
}
}
?>
btw: If anyone knows about a decent way to tell the difference between local and external files, he may feel free to alter this to use filesize instead of the loop or eMail a suggestion to me. :)
Sorry, but I have no idea, why it has been deleted, there's nothing wrong in the script?
Regards,
Christian Stadler