note 118002 added to function.nl2br
| From: | leo dot mauro dot desenv at gmail dot com | Date: | Thu, 17 Sep 2015 12:36:30 +0000 |
| Subject: | note 118002 added to function.nl2br | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-203797@lists.php.net to get a copy of this message | ||
I test empirically this function nl2br and nl2br2 (create by ngkongs at gmail dot com).
Both work nice with different ASCII chars for linebreak, but the function nl2br2 is faster than
nl2br.
nl2br2 ~ 0.0000309944153 s
nl2br ~ 0.0011141300201 s
The function nl2br2:
<?php
function nl2br2($string) {
$string = str_replace(array("\r\n", "\r", "\n"), "<br
/>", $string);
return $string;
}
?>
----
Server IP: 72.52.91.14
Probable Submitter: 187.55.162.200
----
Manual Page -- http://php.net/manual/en/function.nl2br.php
Edit -- https://master.php.net/note/edit/118002
Del: integrated -- https://master.php.net/note/delete/118002/integrated
Del: useless -- https://master.php.net/note/delete/118002/useless
Del: bad code -- https://master.php.net/note/delete/118002/bad+code
Del: spam -- https://master.php.net/note/delete/118002/spam
Del: non-english -- https://master.php.net/note/delete/118002/non-english
Del: in docs -- https://master.php.net/note/delete/118002/in+docs
Del: other reasons-- https://master.php.net/note/delete/118002
Reject -- https://master.php.net/note/reject/118002
Search -- https://master.php.net/manage/user-notes.php