note 27393 added to function.fgets
| From: | dirk at nospam dot de | Date: | Wed, 04 Dec 2002 11:55:11 +0000 |
| Subject: | note 27393 added to function.fgets | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-40337@lists.php.net to get a copy of this message | ||
Never use the while loop in the manner of the examples given above.
If you have an error opening your file "!eof($fd)" will always evalute to true resulting
in an infinite loop.
Something like "while ($fd && !eof($fd)) { }" avoids this problem.
--
http://www.php.net/manual/en/function.fgets.php
http://master.php.net/manage/user-notes.php?action=edit+27393
http://master.php.net/manage/user-notes.php?action=delete+27393
http://master.php.net/manage/user-notes.php?action=reject+27393