note 49762 deleted from function.file-get-contents by nlopess
| From: | nlopess@php.net | Date: | Thu, 10 Feb 2005 10:49:07 +0000 |
| Subject: | note 49762 deleted from function.file-get-contents by nlopess | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-84781@lists.php.net to get a copy of this message | ||
Note Submitter: rpanning at hotmail dot com
----
In case you have PHP < 4.3.0 here is the alternate. Of corse it doesn't support any of the
PHP 5 features, resource context and offset.
<?php
// Check to see if functin exists
if (!function_exists('file_get_contents')) {
// Define function and arguments
function file_get_contents($file, $include=false)
{
// Varify arguments are correct types
if (!is_string($file)) return(false);
if (!is_bool($include)) return(false);
// Open the file with givin options
if (!$handle = @fopen($file, 'rb', $include)) return(false);
// Read data from file
$contents = fread($handle, filesize($file));
// Close file
fclose($handle);
// Return contents of file
return($contents);
}
}
?>