> > 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
--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php