note 19349 added to function.trim
| From: | ednark at wm dot edu | Date: | Mon, 25 Feb 2002 04:11:07 +0000 |
| Subject: | note 19349 added to function.trim | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-26996@lists.php.net to get a copy of this message | ||
if you have an array of strings you want to trim, as in the previous example. It seems the way php
intends you to do so is with the "array_map" function.
http://www.php.net/manual/en/function.array-map.php
$a = array("1", " 3 ", " 555 ");
$b = array_map("trim", $a);
print_r($a);
print_r($b);
Array
(
[0] => 1
[1] => 3
[2] => 555
)
Array
(
[0] => 1
[1] => 3
[2] => 555
)
--
http://www.php.net/manual/en/function.trim.php
http://master.php.net/manage/user-notes.php?action=edit+19349
http://master.php.net/manage/user-notes.php?action=delete+19349
http://master.php.net/manage/user-notes.php?action=reject+19349