note 76022 added to function.trim
| From: | RobinLeffmann at osu1 dot php dot net | Date: | Wed, 27 Jun 2007 00:13:08 +0000 |
| Subject: | note 76022 added to function.trim | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-128008@lists.php.net to get a copy of this message | ||
Here's a faster way to do what's described below:
<?php
$string = 'This string has no whitespaces.';
echo ereg_replace( ' +', '', $string );
?>
Output: Thisstringhasnowhitespaces.
If you want it to replace only single whitespaces instead of both single and cascading dito, remove
the + in the first parameter of ereg_replace().
----
Server IP: 129.16.214.50
Probable Submitter: 83.227.160.33
----
Manual Page -- http://www.php.net/manual/en/function.trim.php
Edit -- https://master.php.net/note/edit/76022
Del: integrated -- https://master.php.net/note/delete/76022/integrated
Del: useless -- https://master.php.net/note/delete/76022/useless
Del: bad code -- https://master.php.net/note/delete/76022/bad+code
Del: spam -- https://master.php.net/note/delete/76022/spam
Del: non-english -- https://master.php.net/note/delete/76022/non-english
Del: in docs -- https://master.php.net/note/delete/76022/in+docs
Del: other reasons-- https://master.php.net/note/delete/76022
Reject -- https://master.php.net/note/reject/76022
Search -- https://master.php.net/manage/user-notes.php