3v4l.org

run code in 300+ PHP versions simultaneously
<?php class A { public function callme(callable $callback) { //call_user_func($callback); $callback(); } public function hi() { echo 'A->hi()' . PHP_EOL; } public static function hiStatic() { echo 'A::hiStatic()' . PHP_EOL; } } class B extends A { public function callme(callable $callback) { //call_user_func($callback); $callback(); } public function hi() { echo 'B->hi()' . PHP_EOL; } public static function hiStatic() { echo 'B::hiStatic()' . PHP_EOL; } } $a = new A(); $b = new B(); $a->callme(array($a, 'hi')); echo "####################\n"; $a->callme(array('A', 'hiStatic')); $a->callme('A::hiStatic'); $a->callme(array('self', 'hiStatic')); $a->callme('self::hiStatic'); $a->callme(array('static', 'hiStatic')); $a->callme('static::hiStatic'); echo "####################\n"; $b->callme(array('B', 'hiStatic')); $b->callme(array('self', 'hiStatic')); $b->callme(array('static', 'hiStatic')); echo "####################\n"; $b->callme('B::hiStatic'); $b->callme('self::hiStatic'); $b->callme('static::hiStatic'); echo "####################\n"; $b->callme(array('parent', 'hi')); $b->callme(array('parent', 'hiStatic')); echo "####################\n"; $b->callme('parent::hi'); $b->callme('parent::hiStatic');
Output for git.master, git.master_jit, rfc.property-hooks
A->hi() #################### A::hiStatic() A::hiStatic() Deprecated: Use of "self" in callables is deprecated in /in/1oSO3 on line 4 Fatal error: Uncaught Error: Class "self" not found in /in/1oSO3:6 Stack trace: #0 /in/1oSO3(31): A->callme(Array) #1 {main} thrown in /in/1oSO3 on line 6
Process exited with code 255.

This tab shows result from various feature-branches currently under review by the php developers. Contact me to have additional branches featured.

Active branches

Archived branches

Once feature-branches are merged or declined, they are no longer available. Their functionality (when merged) can be viewed from the main output page


preferences:
36.56 ms | 406 KiB | 5 Q