Issue
I have a PHP library function expecting a callback with no arguments.
I know I can pass an object's method with array($this , 'my_function_name')
but how can I give parameters to the my_function_name
?
I have found a solution using create_function
but from PHP manual I see it has security issues.
Solution
$that = $this;
$wrapper = function() use($that) {
return $that->my_function_name('arg1', 'arg2');
};
Answered By - zerkms
No comments:
Post a Comment
Note: Only a member of this blog may post a comment.