How to implement callback methods inside classes (PHP)
- by sombe
I need to use a class callback method on an array inside another method (the callback function belongs to the class).
class Database {
public function escape_string_for_db($string){
return mysql_real_escape_string($string);
}
public function escape_all_array($array){
return array_filter($array,"$this->escape_string_for_db");
}
}
Is this the right way to go about that? (I mean, in terms of the second parameter passed to array_filter)