I want to use array_map with a static method but I fail. Here is my code :
Class Buy {
public function payAllBills() {
$bill_list = OtherClass::getBillList();
return array_map(array(self, 'pay'), $bill_list); // Issue line
}
private static function pay($bill) {
// Some stuff
return true;
}
}
PHP gives me the error :
Use of undefined constant self - assumed 'self'
I have also tried :
return array_map('self::makeBean()', $model_list);
But it doesn't work.
Do you have any idea how to use array_map with static method ?
I have already read : Can a method be used as a array_map function in PHP 5.2? but this question is about standard methods, not statics.