note 78130 added to function.nl2br
| From: | phpdoc at povaddict dot com dot ar | Date: | Fri, 28 Sep 2007 22:51:57 +0000 |
| Subject: | note 78130 added to function.nl2br | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-130897@lists.php.net to get a copy of this message | ||
@flashyeu at yahoo dot com:
It's a newline. Browsers show newlines in the HTML code as spaces, unless in a <pre> tag.
Try this:
<?php
header("Content-Type: text/plain");
$str = 'One plus one is two
Two plus two is four.';
$str = nl2br($str);
$str = strip_tags($str);
print str_replace(' ','',$str);
//out put Oneplusoneistwo Twoplustwoisfour.
?>
----
Server IP: 190.2.55.3
Probable Submitter: 201.212.126.164
----
Manual Page -- http://www.php.net/manual/en/function.nl2br.php
Edit -- https://master.php.net/note/edit/78130
Del: integrated -- https://master.php.net/note/delete/78130/integrated
Del: useless -- https://master.php.net/note/delete/78130/useless
Del: bad code -- https://master.php.net/note/delete/78130/bad+code
Del: spam -- https://master.php.net/note/delete/78130/spam
Del: non-english -- https://master.php.net/note/delete/78130/non-english
Del: in docs -- https://master.php.net/note/delete/78130/in+docs
Del: other reasons-- https://master.php.net/note/delete/78130
Reject -- https://master.php.net/note/reject/78130
Search -- https://master.php.net/manage/user-notes.php