- is_callable: documentation ( source)
<?php
class ParentClass {
public function foo() {
}
}
class ChildClass extends ParentClass {
public function foo() {
}
}
$parentCallable = [new ChildClass(), 'parent::foo'];
$childCallable = [new ChildClass(), 'self::foo'];
\is_callable($parentCallable, false, $parentName);
\is_callable($childCallable, false, $childName);
echo $parentName;
echo "\n";
echo $childName;