- var_dump: documentation ( source)
- is_callable: documentation ( source)
<?php
class CallBySelf
{
public static function foo()
{
echo 'Foo', PHP_EOL;
}
public static function testCall()
{
$method = [self::class, 'foo'];
var_dump(is_callable($method));
echo 'Call via call_user_func: ';
call_user_func($method);
echo 'Direct call: ';
$method();
}
}
CallBySelf::testCall();