Re: New lines

From: Date: Tue, 03 Feb 2004 20:06:34 +0000
Subject: Re: New lines
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-176725@lists.php.net to get a copy of this message
Robert Sossomon wrote:
There was a wong answer and then there is the right answer: $fp = fopen($file,"r"); while (!feof($fp)) {
    $line = fgets($fp, 4096); //gets one line at a time
    echo $line; // Or whatever else you want to do
} fclose($fp); HTH. Robert
If all the OP wants to do is echo out the file, then why not just use the file() function. Then each line is loaded up into an array element, and you've saved yourself a bit of cpu. And your example above doesn't address the OP's claim that it is not handling new lines. Course, without seeing his code, or having him explain the issue a bit better, all we're doing is spitting in the wind. -- By-Tor.com It's all about the Rush http://www.by-tor.com

« previous php.general (#176725) next »