note 77511 added to function.trim
| From: | PincoPallino at osu1 dot php dot net | Date: | Sat, 01 Sep 2007 19:08:30 +0000 |
| Subject: | note 77511 added to function.trim | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-130072@lists.php.net to get a copy of this message | ||
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.
----
Server IP: 213.92.11.19
Probable Submitter: 85.239.180.92
----
Manual Page -- http://www.php.net/manual/en/function.trim.php
Edit -- https://master.php.net/note/edit/77511
Del: integrated -- https://master.php.net/note/delete/77511/integrated
Del: useless -- https://master.php.net/note/delete/77511/useless
Del: bad code -- https://master.php.net/note/delete/77511/bad+code
Del: spam -- https://master.php.net/note/delete/77511/spam
Del: non-english -- https://master.php.net/note/delete/77511/non-english
Del: in docs -- https://master.php.net/note/delete/77511/in+docs
Del: other reasons-- https://master.php.net/note/delete/77511
Reject -- https://master.php.net/note/reject/77511
Search -- https://master.php.net/manage/user-notes.php