note 108828 added to function.nl2br
| From: | priyankmg at gmail dot com | Date: | Mon, 28 May 2012 16:37:05 +0000 |
| Subject: | note 108828 added to function.nl2br | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-188266@lists.php.net to get a copy of this message | ||
can someone explain why str_replace() behaves like the below:
$str = "foo\r\nbar";
1) echo str_replace('\r'.'\n',"<br/>",$str);
prints:
foo
bar
2) echo str_replace("\r\n","<br/>",$str);
prints:
foo\r\nbar
----
Server IP: 69.147.83.197
Probable Submitter: 59.182.41.39
----
Manual Page -- http://www.php.net/manual/en/function.nl2br.php
Edit -- https://master.php.net/note/edit/108828
Del: integrated -- https://master.php.net/note/delete/108828/integrated
Del: useless -- https://master.php.net/note/delete/108828/useless
Del: bad code -- https://master.php.net/note/delete/108828/bad+code
Del: spam -- https://master.php.net/note/delete/108828/spam
Del: non-english -- https://master.php.net/note/delete/108828/non-english
Del: in docs -- https://master.php.net/note/delete/108828/in+docs
Del: other reasons-- https://master.php.net/note/delete/108828
Reject -- https://master.php.net/note/reject/108828
Search -- https://master.php.net/manage/user-notes.php