note 82575 deleted from function.trim by hholzgra
| From: | hholzgra@php.net | Date: | Thu, 02 Aug 2012 12:26:40 +0000 |
| Subject: | note 82575 deleted from function.trim by hholzgra | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-189658@lists.php.net to get a copy of this message | ||
Note Submitter: me at robhaswell dot co dot uk
----
admin at semaster dot ru's array_trim function is flawed in that it will change the type of
nulls and numeric variables (to strings).
Here is a better version, although it lacks charlist support:
<?php
function array_trim($var) {
if (is_array($var))
return array_map("array_trim", $var);
if (is_string($var))
return trim($var);
return $var;
}
?>
-Rob