note 44248 added to function.file-get-contents

From: Date: Mon, 19 Jul 2004 17:29:59 +0000
Subject: note 44248 added to function.file-get-contents
Groups: php.notes 
Request: Send a blank email to php-notes+get-73617@lists.php.net to get a copy of this message
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. ---- Manual Page -- http://www.php.net/manual/en/function.file-get-contents.php Edit -- http://master.php.net/manage/user-notes.php?action=edit+44248 Delete -- http://master.php.net/manage/user-notes.php?action=delete+44248&report=yes Reject -- http://master.php.net/manage/user-notes.php?action=reject+44248&report=yes Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#73617) next »