Callable

suggest change

Callables are anything which can be called as a callback. Things that can be termed a “callback” are as follows:

Example Of referencing an object as an array element:

$obj = new MyClass();
call_user_func([$obj, 'myCallbackMethod']);

Callbacks can be denoted by callable type hint as of PHP 5.4.

$callable = function () {
    return 'value';
};

function call_something(callable $fn) {
    call_user_func($fn);
}

call_something($callable);

Feedback about page:

Feedback:
Optional: your email if you want me to get back to you:



Table Of Contents