note 97374 added to function.str-replace
| From: | fleshgrinder at gmx dot at | Date: | Fri, 16 Apr 2010 12:50:56 +0000 |
| Subject: | note 97374 added to function.str-replace | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-168321@lists.php.net to get a copy of this message | ||
Fast function to replace new lines from a given string. This is interesting to replace all new lines
from e. g. a text formatted in HTML retrieved from database and printing it without the unnecessary
new lines. This results in slightly faster rendering in the Web browser.
<?php
/**
* Replace all linebreaks with one whitespace.
*
* @access public
* @param string $string
* The text to be processed.
* @return string
* The given text without any linebreaks.
*/
function replace_newline($string) {
return (string)str_replace(array("\r", "\r\n", "\n"), '',
$string);
}
?>
----
Server IP: 69.147.83.197
Probable Submitter: 81.28.136.190
----
Manual Page -- http://www.php.net/manual/en/function.str-replace.php
Edit -- https://master.php.net/note/edit/97374
Del: integrated -- https://master.php.net/note/delete/97374/integrated
Del: useless -- https://master.php.net/note/delete/97374/useless
Del: bad code -- https://master.php.net/note/delete/97374/bad+code
Del: spam -- https://master.php.net/note/delete/97374/spam
Del: non-english -- https://master.php.net/note/delete/97374/non-english
Del: in docs -- https://master.php.net/note/delete/97374/in+docs
Del: other reasons-- https://master.php.net/note/delete/97374
Reject -- https://master.php.net/note/reject/97374
Search -- https://master.php.net/manage/user-notes.php