Shouldn’t the 2nd argument be a function?
The second argument should be a value of type callable
. callable
s are a fundamental type in PHP.
E.g. these are some valid callables:
Value | Equivalent |
---|---|
'test' |
test() |
[ $obj, 'test' ] |
$obj->test() |
[ 'foo', 'bar' ] |
foo::bar() |
function() {...} or closure |
$foo = function(){...}; $foo(); |
And so on, see the official docs at php.net for more details.