note 49762 added to function.file-get-contents

From: Date: Tue, 08 Feb 2005 06:58:22 +0000
Subject: note 49762 added to function.file-get-contents
Groups: php.notes 
Request: Send a blank email to php-notes+get-84647@lists.php.net to get a copy of this message
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); } } ?> ---- Manual Page -- http://www.php.net/manual/en/function.file-get-contents.php Edit -- http://master.php.net/manage/user-notes.php?action=edit+49762 Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+49762&report=yes&reason=added+to+the+manual Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+49762&report=yes&reason=bad+code Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+49762&report=yes&reason=spam Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+49762&report=yes&reason=useless Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+49762&report=yes Reject -- http://master.php.net/manage/user-notes.php?action=reject+49762&report=yes Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#84647) next »