note 107837 deleted from function.trim by hholzgra
| From: | hholzgra@php.net | Date: | Thu, 02 Aug 2012 12:32:53 +0000 |
| Subject: | note 107837 deleted from function.trim by hholzgra | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-189682@lists.php.net to get a copy of this message | ||
Note Submitter: AirborneAgain
----
Alternate way to trim and combine duplicate whitespace characters in a string:
<?php
$text = " john q. doe ";
$text = trim(implode(' ', preg_split('/\s+/', $text)));
?>