note 36722 added to function.file-get-contents
| From: | webmaster at ragnarokonline dot de | Date: | Mon, 20 Oct 2003 11:02:15 +0000 |
| Subject: | note 36722 added to function.file-get-contents | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-58929@lists.php.net to get a copy of this message | ||
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;
}
}
?>
----
Manual Page -- http://www.php.net/manual/en/function.file-get-contents.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+36722
Delete -- http://master.php.net/manage/user-notes.php?action=delete+36722&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+36722&report=yes
Search -- http://master.php.net/manage/user-notes.php