I have a class with 2 functions. One function has the array map that pass the array to another function within the same class. Unfortunatly the array is dumped as NULL. Any fix?
class filter
{
public function filt($value)
{
$value = mysql_escape_string($value);
$value = trim($value);
return $value;
}
public function passover($variables)
{
$variables = array_map("filt",$variables);
return $variables;
}
}
$filter = new filter();
$m= $filter->passover($arr =array('smith'=>1, 'smith'=>2));
var_dump($m);
To provide an object method as callback, you need a different syntax:
http://php.net/manual/en/language.types.callable.php