RE: [PHP] Trimming Array value
| From: | Jason Murray | Date: | Thu, 21 Jun 2001 03:59:48 +0000 |
| Subject: | RE: [PHP] Trimming Array value | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-54661@lists.php.net to get a copy of this message | ||
> I have a multi-dimensional array. I want to trim every values
> so that none of them have trailing space.
>
> What is the most efficient way to do that ?
> I don't necessaryly know the dimension of the array ahead of
> time, so the function need to be able to handle it recursively.
For a 1-D array:
foreach ($array as $key => $value)
{
$array[$key] => $value;
}
... apply some recursion to that and you should be set.
Jason