3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php class Foo { function __construct() { call_user_func([$this, 'test']); call_user_func([$this, 'self::test']); call_user_func([$this, 'static::test']); self::test(); } function test() { echo "foo\n"; } } class Bar extends Foo { function __construct() { call_user_func([$this, 'test']); call_user_func([$this, 'self::test']); call_user_func([$this, 'parent::test']); call_user_func([$this, 'Foo::test']); call_user_func([$this, 'Bar::test']); echo "---\n"; parent::__construct(); } function test() { echo "bar\n"; } } new Bar;
based on RO7Rc
Output for 5.6.30, hhvm-3.18.5 - 3.22.0, 7.0.30 - 7.3.0beta1
bar bar foo foo bar --- bar bar bar foo