note 38082 deleted from function.file-get-contents by didou
| From: | didou@php.net | Date: | Mon, 26 Jan 2004 08:54:21 +0000 |
| Subject: | note 38082 deleted from function.file-get-contents by didou | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-64192@lists.php.net to get a copy of this message | ||
Note Submitter:
----
Here's a version, that uses filesize, if possible:
If you're having problems with this version, use the older version I've posted below.
<?php
if (!function_exists("file_get_contents")) {
function file_get_contents($filename, $use_include_path = 0) {
$file = @fopen($filename, "rb", $use_include_path);
if ($file) {
if ($fsize = @filesize($filename)) {
$data = fread($file, $fsize);
} else {
$data = ""; // just to be safe. Dunno, if this is really needed
while (!feof($file)) $data .= fread($file, 1024);
}
fclose($file);
}
return $data;
}
}
?>