Reputation: 51
I struggle to understand how I can add a second parameter ($id) to pass along with this callback in my php class:
($this, 'updateDuplicateAcronym')
The method updateDuplicateAcronym should recieve 2 parameters, one by reference from the form where this code belongs (which works fine), and one more that I need in order to do some checks.
Someone who knows how to do this?
Upvotes: 1
Views: 1597
Reputation: 929
Here is my method to pass parameters :
$callBackFunction = function($p1, $p2) {
...
}
baseFunction($context, $callable, $params)
{
//Main process
call_user_func($callable, $params);
}
// Running
baseFunction($this, $callBackFunction, array(1, 42));
Upvotes: 2