Re: cvs: php4 /ext/standard file.c /main php_streams.h streams.c
| From: | Rasmus Lerdorf | Date: | Fri, 18 Oct 2002 22:45:33 +0000 |
| Subject: | Re: cvs: php4 /ext/standard file.c /main php_streams.h streams.c | ||
| References: | 1 | Groups: | php.cvs |
| Request: | Send a blank email to php-cvs+get-15037@lists.php.net to get a copy of this message | ||
> > But EOL is not always \n and it can be a mix of \r\n \n or \r. You have
> > no way of knowing which eol caused the break for any particular line. In
> > that sense file() is irreversible.
>
> Why would I care about that, the EOL are not stripped by file(), so I do not
> need to know EOLs when assembling the file back. As long as I assemble the
> number of lines equal to the number of lines read, I will get the same file.
Ah, you are right. You have fixed this now. I just tested your code. In
the past something like:
$a = file('abc');
$fp = fopen("abc.new","w");
foreach($a as $l) {
fwrite($fp, $l);
}
fclose($fp);
Would create an abc.new file that was different from abc.
-Rasmus