A new class has been created for a PHP project as follows:
class Cleanse
{
# trims leading and trailing spaces
public static function trimmer($values)
{
return is_array($values) ?
array_map('trimmer', $values) :
trim($values);
}
}
However, when trying to use this functionality like so:
$values = Cleanse::trimmer($_POST);
the following warning message is returned: Warning: array_map() expects parameter 1 to be a valid callback, function 'trimmer' not found or invalid function name in (class file path) on line 41.
What is wrong with this code and/or this approach?