note 42581 added to ref.array
| From: | MinotsEstich� | Date: | Sat, 22 May 2004 02:10:14 +0000 |
| Subject: | note 42581 added to ref.array | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-69931@lists.php.net to get a copy of this message | ||
Sometimes it´s usefull to trim all values from a given array.
I wrote this function ( array_trim ) to do it for me:
<?php
function array_trim(&$arr)
{
while (list($key,$val)=each($arr)):
if ( (strtoupper($key) != $key or ''.intval($key) == "$key") && $key
!= "argc" and $key != "argv"):
if (is_string($val)):
$arr[$key] = trim($val);
endif;
if (is_array($val)):
$arr[$key] = array_trim($val);
endif;
endif;
endwhile;
return $arr;
}
?>
If there is a better way, feel free to send me a note via
feedback-formular at http://www.d0x.de/pages/kontakt.php .
----
Manual Page -- http://www.php.net/manual/en/ref.array.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+42581
Delete -- http://master.php.net/manage/user-notes.php?action=delete+42581&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+42581&report=yes
Search -- http://master.php.net/manage/user-notes.php