note 108828 rejected from function.nl2br by danbrown
| From: | danbrown@php.net | Date: | Mon, 28 May 2012 16:42:50 +0000 |
| Subject: | note 108828 rejected from function.nl2br by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-188267@lists.php.net to get a copy of this message | ||
Note Submitter: priyankmg at gmail dot com
----
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