How to pass a callback function as a parameter in PHP Back
In PHP, if you want to pass a callback function into another one, you are supposed to use call_user_func
.
<?php
/** Definition */
function f($opt, $callback) {
/** Operation */
/** ... */
call_user_func($callback);
}
/** Calling */
f($opt, function () use ($innerOpt) {
echo 'callBack';
});
?>
As the plugin is integrated with a code management system like GitLab or GitHub, you may have to auth with your account before leaving comments around this article.
Notice: This plugin has used Cookie to store your token with an expiration.