note 8360 modified in str_replace by jmcastagnetto
| From: | jmcastagnetto@php.net | Date: | Fri, 08 Sep 2000 02:10:48 +0000 |
| Subject: | note 8360 modified in str_replace by jmcastagnetto | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-4473@lists.php.net to get a copy of this message | ||
[Editor's note: Simpler solution: $string = chop($string)."%0a"; ]
Sometimes you want to pass a string with line breaks in it through HTTP while keeping the integrity
of the original string. To do this replace the newline characters with the HTTP friendly
"%0a".
ex.
$string = preg_replace("/\r\n|\n\r|\n|\r/", "%0a", $string);
http://www.php.net/manual/function.str-replace.php