note 47569 modified in function.str-replace by tularis
| From: | tularis@php.net | Date: | Sat, 20 Nov 2004 19:57:26 +0000 |
| Subject: | note 47569 modified in function.str-replace by tularis | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-80811@lists.php.net to get a copy of this message | ||
---[ Editor's Note ]---
This way works, but it's easier to just use nl2br() instead, which supports both \n and \r,
whereas this function does not support both.
---[ End Note ]---
This is an easy way to replace the breaks and paragrafs submitted via a Textarea to <br>s in
the output.
<?Php
$test="Teststring
test test
test test test test";
echo str_replace(Chr(13), "<br>", $test);
?>
--was--
This is an easy way to replace the breaks and paragrafs submitted via a Textarea to <br>s in
the output.
<?Php
$test="Teststring
test test
test test test test";
echo str_replace(Chr(13), "<br>", $test);
?>
http://php.net/manual/en/function.str-replace.php