note 38082 added to function.file-get-contents

From: Date: Sun, 07 Dec 2003 21:24:06 +0000
Subject: note 38082 added to function.file-get-contents
Groups: php.notes 
Request: Send a blank email to php-notes+get-61605@lists.php.net to get a copy of this message
Here's a version, that uses filesize, if possible: If you're having problems with this version, use the older version I've posted below. <?php if (!function_exists("file_get_contents")) { function file_get_contents($filename, $use_include_path = 0) { $file = @fopen($filename, "rb", $use_include_path); if ($file) { if ($fsize = @filesize($filename)) { $data = fread($file, $fsize); } else { $data = ""; // just to be safe. Dunno, if this is really needed while (!feof($file)) $data .= fread($file, 1024); } fclose($file); } return $data; } } ?> ---- Manual Page -- http://www.php.net/manual/en/function.file-get-contents.php Edit -- http://master.php.net/manage/user-notes.php?action=edit+38082 Delete -- http://master.php.net/manage/user-notes.php?action=delete+38082&report=yes Reject -- http://master.php.net/manage/user-notes.php?action=reject+38082&report=yes Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#61605) next »