note 44248 deleted from function.file-get-contents by tomsommer
| From: | tomsommer@php.net | Date: | Mon, 19 Jul 2004 19:23:23 +0000 |
| Subject: | note 44248 deleted from function.file-get-contents by tomsommer | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-73621@lists.php.net to get a copy of this message | ||
Note Submitter: Craig@chatspike.net
----
in extention to aidan at php dot net's note, if you do not wish to download the PEAR package,
the function is below:
<?php
if (!function_exists('file_get_contents'))
{
function file_get_contents ($filename, $incpath = false, $rcontext = null)
{
if (false === $fh = fopen($filename, 'rb', $incpath)) {
trigger_error('file_get_contents() failed to open stream: No such file or
directory', E_USER_WARNING);
return false;
}
clearstatcache();
if ($fsize = filesize($filename)) {
$data = fread($fh, $fsize);
}
else {
while (!feof($fh)) {
$data .= fread($fh, 8192);
}
}
fclose($fh);
return $data;
}
}
?>
I hope someone finds this of use.