3v4l.org

run code in 200+ PHP versions simultaneously
<?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;
Output for 5.6.30 - 7.2.9
ChildClass::parent::foo ChildClass::self::foo