note 107837 added to function.trim
| From: | AirborneAgain | Date: | Thu, 08 Mar 2012 17:50:18 +0000 |
| Subject: | note 107837 added to function.trim | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-186547@lists.php.net to get a copy of this message | ||
Alternate way to trim and combine duplicate whitespace characters in a string:
<?php
$text = " john q. doe ";
$text = trim(implode(' ', preg_split('/\s+/', $text)));
?>
----
Server IP: 69.147.83.197
Probable Submitter: 67.131.51.156
----
Manual Page -- http://www.php.net/manual/en/function.trim.php
Edit -- https://master.php.net/note/edit/107837
Del: integrated -- https://master.php.net/note/delete/107837/integrated
Del: useless -- https://master.php.net/note/delete/107837/useless
Del: bad code -- https://master.php.net/note/delete/107837/bad+code
Del: spam -- https://master.php.net/note/delete/107837/spam
Del: non-english -- https://master.php.net/note/delete/107837/non-english
Del: in docs -- https://master.php.net/note/delete/107837/in+docs
Del: other reasons-- https://master.php.net/note/delete/107837
Reject -- https://master.php.net/note/reject/107837
Search -- https://master.php.net/manage/user-notes.php