Here is a sample class:
class A{
.
.
.
public function updateAction(){
$tags=explode(' ',$taglist);
.
.
.
$tagsInDb=$tagsInDb->toArray();
$dif=array_diff_uassoc($tags,$tagsInDb,"here the callback should be inserted");
}
protected function callback_function_for_array_diff($a,$b){
}
}
How can I call callback_function_for_array_diff as a callback function for array_diff_uassoc?
The different types of specifying a callback are described here:
http://www.php.net/manual/en/function.call-user-func.php
As you do not have a static function, you need an instance of the class, i.e. $this
So you can specify the callback as
array($this, callback_function_for_array_diff)Or you make a
Then it would be
"A::callback_function_for_array_diff"orarray("A","callback_function_for_array_diff")