3v4l.org

run code in 300+ PHP versions simultaneously
<?php class a { public $pub = 'public in a'; function pub() { echo "Entering a::pub\n"; var_dump($this->pub); echo "Leaving a::pub\n"; } } class x { public $pub = 'public in x'; function pub() { echo "Entering x::pub\n"; a::pub(); echo "Leaving x::pub\n"; } } function main() { $a = new a; $x = new x; echo "Calling a->pub\n"; $a->pub(); echo "Calling x->pub\n"; $x->pub(); } echo "Calling main()\n"; main(); echo "Done\n";
Output for git.master, git.master_jit, rfc.property-hooks
Calling main() Calling a->pub Entering a::pub string(11) "public in a" Leaving a::pub Calling x->pub Entering x::pub Fatal error: Uncaught Error: Non-static method a::pub() cannot be called statically in /in/v9UnE:16 Stack trace: #0 /in/v9UnE(28): x->pub() #1 /in/v9UnE(32): main() #2 {main} thrown in /in/v9UnE on line 16
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:
42.26 ms | 401 KiB | 8 Q