note 39183 deleted from function.fgets by nlopess

From: Date: Mon, 01 Mar 2004 14:25:46 +0000
Subject: note 39183 deleted from function.fgets by nlopess
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-66047@lists.php.net to get a copy of this message
Note Submitter: ---- If you are using a version of PHP prior to 4.3, but need the functionality that auto_detect_line_endings offers, try this function as an alternative: /** * GetLine * Obtain the next line in a given file by reading each character * until a \r or \n is reached. * * @param file a handle returned from fopen for the file. * @return string the next line in the file. */ function getLine($file) { // iterate over each character in line. while ($character = fgetc($file)) { // check for end of line. if (($character == "\n") or ($character == "\r")) { // end of line, so stop reading. break; } else { // not EOL, so append to buffer. $buffer .= $character; } } // return the line buffer. return $buffer; }

« previous php.notes (#66047) next »