note 68460 added to function.stream-get-line

From: Date: Thu, 27 Jul 2006 15:51:48 +0000
Subject: note 68460 added to function.stream-get-line
Groups: php.notes 
Request: Send a blank email to php-notes+get-115276@lists.php.net to get a copy of this message
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é ---- Server IP: 216.235.15.211 Probable Submitter: 67.68.182.172 ---- X-Spam-Status: No, hits=3.1 required=5.0 tests=DATE_MISSING,FROM_NO_LOWER autolearn=no version=2.64 ---- Manual Page -- http://www.php.net/manual/en/function.stream-get-line.php Edit -- http://master.php.net/note/edit/68460 Del: integrated -- http://master.php.net/note/delete/68460/integrated Del: useless -- http://master.php.net/note/delete/68460/useless Del: bad code -- http://master.php.net/note/delete/68460/bad+code Del: spam -- http://master.php.net/note/delete/68460/spam Del: non-english -- http://master.php.net/note/delete/68460/non-english Del: in docs -- http://master.php.net/note/delete/68460/in+docs Del: other reasons-- http://master.php.net/note/delete/68460 Reject -- http://master.php.net/note/reject/68460 Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#115276) next »