I want to do something like this:
function func($callback) {
$result = $callback(???); // $callback must be called here
//...
}
//...
func(function(['foo' => 'buu']) {
$a = func_get_arg(0);
// do something with $a and return something...
return $something;
})
It is possible in php?
I can do something like below, but this is not what I want to do:
function func($args, $callback) {
$result = $callback($args);
//...
}
func(['foo' => 'boo'], function($args) {
$a = $args; // etc.
})