3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Foobar { public static function foo() { var_dump(debug_backtrace()); } } $instance = new Foobar; $className = 'Foobar'; echo "\n", 'Foobar::foo();', "\n"; Foobar::foo(); echo "\n", '$instance->foo();', "\n"; $instance->foo(); //echo "\n", '$instance::foo();', "\n"; //$instance::foo(); //echo "\n", '$className::foo();', "\n"; //$className::foo();
Output for git.master, git.master_jit, rfc.property-hooks
Foobar::foo(); array(1) { [0]=> array(6) { ["file"]=> string(9) "/in/DHZ8M" ["line"]=> int(14) ["function"]=> string(3) "foo" ["class"]=> string(6) "Foobar" ["type"]=> string(2) "::" ["args"]=> array(0) { } } } $instance->foo(); array(1) { [0]=> array(6) { ["file"]=> string(9) "/in/DHZ8M" ["line"]=> int(17) ["function"]=> string(3) "foo" ["class"]=> string(6) "Foobar" ["type"]=> string(2) "::" ["args"]=> array(0) { } } }

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:
73.3 ms | 402 KiB | 8 Q