note 68460 rejected from function.stream-get-line by nlopess

From: Date: Thu, 27 Jul 2006 15:55:23 +0000
Subject: note 68460 rejected from function.stream-get-line by nlopess
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-115279@lists.php.net to get a copy of this message
Note Submitter: andregodin at gmail dot com ---- this function seems to don't work like i want if i try to read line terminated by "\r\n". And when i try to put 0 at the second parameter (length) it make my apache crash with the code 3221225477 (a so popular code). (Maybe it's just my php 5.0.5) For people trying to read line terminated by "\r\n" you can reuse fgets like this: <?php $lineTemp = fgets($fileHandle); while((substr($string, -2, 2) != "\r\n") && (!feof($fileHandle))){ $lineTemp .= fgets($fileHandle); } if (!feof($fileHandle)){ //delete last two charcters $lineTemp = substr($lineTemp, 0, -2); } ?> hope it helps you André

« previous php.notes (#115279) next »