note 48153 added to function.str-replace
| From: | AdamAtlas | Date: | Tue, 14 Dec 2004 01:58:49 +0000 |
| Subject: | note 48153 added to function.str-replace | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-81771@lists.php.net to get a copy of this message | ||
Here's a function way to convert Mac-style carriage returns to Unix-style linefeeds.
<?php
function cr2lf($data) {
echo str_replace(chr(13), chr(10), $data);
}
?>
I use it as a CLI script like this:
<?php
$d = file_get_contents('/dev/stdin');
echo str_replace(chr(13), chr(10), $data);
?>
----
Manual Page -- http://www.php.net/manual/en/function.str-replace.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+48153
Delete -- http://master.php.net/manage/user-notes.php?action=delete+48153&report=yes
Reason: bad code -- http://master.php.net/manage/user-notes.php?action=delete+48153&report=yes&reason=bad+code
Reason: spam -- http://master.php.net/manage/user-notes.php?action=delete+48153&report=yes&reason=spam
Reason: useless example -- http://master.php.net/manage/user-notes.php?action=delete+48153&report=yes&reason=useless+example
Reason: contains commercial links -- http://master.php.net/manage/user-notes.php?action=delete+48153&report=yes&reason=contains+commercial+links
Reason: useless note -- http://master.php.net/manage/user-notes.php?action=delete+48153&report=yes&reason=useless+note
Reject -- http://master.php.net/manage/user-notes.php?action=reject+48153&report=yes
Search -- http://master.php.net/manage/user-notes.php