note 39817 added to function.file-get-contents

From: Date: Wed, 11 Feb 2004 17:45:37 +0000
Subject: note 39817 added to function.file-get-contents
Groups: php.notes 
Request: Send a blank email to php-notes+get-65018@lists.php.net to get a copy of this message
To be exactly compatible with file_get_contents, that should be: <?php if (!function_exists("file_get_contents")) { function file_get_contents($filename, $use_include_path = 0) { $data = FALSE; $file = fopen($filename, "rb", $use_include_path); if ($file) { while (!feof($file)) $data .= fread($file, 1024); fclose($file); } return $data; } } ?> That is, return FALSE on failure, and print error messages from fopen(). ---- Manual Page -- http://www.php.net/manual/en/function.file-get-contents.php Edit -- http://master.php.net/manage/user-notes.php?action=edit+39817 Delete -- http://master.php.net/manage/user-notes.php?action=delete+39817&report=yes Reject -- http://master.php.net/manage/user-notes.php?action=reject+39817&report=yes Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#65018) next »