RE: [PHP] Trimming Array value
> 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 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Trimming Array value
something like this: $val) $ar[$key] = is_array($val) ? recursive_rtrim($val) : rtrim($val); return $ar; } ?> lenar. ""Reuben D Budiardja"" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... 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. Thanks Reuben D. Budiardja -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] Trimming Array value
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. Thanks Reuben D. Budiardja -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]