note 77511 deleted from function.trim by hholzgra
| From: | hholzgra@php.net | Date: | Thu, 02 Aug 2012 12:26:24 +0000 |
| Subject: | note 77511 deleted from function.trim by hholzgra | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-189656@lists.php.net to get a copy of this message | ||
Note Submitter: Pinco Pallino
----
As already commented by thers the solution from Robin Leffmann to remove "all"
the spaces from a string not only does not trim the "other" chars besides plain
spaces but is at all not faster than jayoungh5's proposal.
The only faster way I can imagine of is:
function trimall($str, $charlist = " \t\n\r\0\x0B")
{
return str_replace(str_split($charlist), '', $str);
}
However jayoungh5's one might still be faster for very large sets of characters
to be stripped.