note 69321 added to function.str-replace
| From: | fatidik at osu1 dot php dot net | Date: | Thu, 31 Aug 2006 15:30:27 +0000 |
| Subject: | note 69321 added to function.str-replace | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-116544@lists.php.net to get a copy of this message | ||
I came up with my own solution to get rid of newline characters. The one on this site is good but
this one just gets rid of newline character regardless of which one it is (might be \r\n, \n\r, \n
or \r) and replaces it just once (no double replace in case of double newline character (\r\n and
\n\r).
//Replaces newline characters in $sString with $sReplace
function str_repl_nline($sReplace, $sString) {
return str_replace(array("\r\n", "\n\r", "\n", "\r"),
$sReplace, $sString);
}
Enjoy
----
Server IP: 201.216.232.3
Probable Submitter: 200.68.74.161 (proxied: unknown)
----
X-Spam-Status: No, hits=3.1 required=5.0 tests=DATE_MISSING,FROM_NO_LOWER
autolearn=no version=2.64
----
Manual Page -- http://www.php.net/manual/en/function.str-replace.php
Edit -- https://master.php.net/note/edit/69321
Del: integrated -- https://master.php.net/note/delete/69321/integrated
Del: useless -- https://master.php.net/note/delete/69321/useless
Del: bad code -- https://master.php.net/note/delete/69321/bad+code
Del: spam -- https://master.php.net/note/delete/69321/spam
Del: non-english -- https://master.php.net/note/delete/69321/non-english
Del: in docs -- https://master.php.net/note/delete/69321/in+docs
Del: other reasons-- https://master.php.net/note/delete/69321
Reject -- https://master.php.net/note/reject/69321
Search -- https://master.php.net/manage/user-notes.php