note 21649 added to function.fgets
| From: | ylringwood at mailcity dot com | Date: | Wed, 22 May 2002 06:51:27 +0000 |
| Subject: | note 21649 added to function.fgets | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-30883@lists.php.net to get a copy of this message | ||
In response to carlomitchell@hotmail.com saying the following takes a long time,
while(!feof($fp))
$buffer[] = chop(fgets($fp,filesize($filename)));
Well, if you were to get the file length outside the loop, it would only have to ask once, making it
quicker.
$fsize = filesize($filename);
while(!feof($fp))
$buffer[] = chop(fgets($fp,$fsize));
--
http://www.php.net/manual/en/function.fgets.php
http://master.php.net/manage/user-notes.php?action=edit+21649
http://master.php.net/manage/user-notes.php?action=delete+21649
http://master.php.net/manage/user-notes.php?action=reject+21649