note 76022 deleted from function.trim by hholzgra
| From: | hholzgra@php.net | Date: | Thu, 02 Aug 2012 12:25:00 +0000 |
| Subject: | note 76022 deleted from function.trim by hholzgra | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-189651@lists.php.net to get a copy of this message | ||
Note Submitter: Robin Leffmann
----
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().