3v4l.org

run code in 300+ PHP versions simultaneously
<?php //error_reporting(-1); class A { function B() { echo "instance method B\n"; } static function C() { echo "static method C\n"; } } $a = new A(); echo "Calling B statically referenced: "; $a::B(); echo "Calling C statically referenced: "; $a::C(); echo "Calling B statically: "; A::B(); echo "Calling C statically: "; A::C(); echo "Calling B instantiated: "; $a->B(); echo "Calling C instantiated: "; $a->C();
Output for git.master, git.master_jit, rfc.property-hooks
Calling B statically referenced: Fatal error: Uncaught Error: Non-static method A::B() cannot be called statically in /in/tuf1I:15 Stack trace: #0 {main} thrown in /in/tuf1I on line 15
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:
41.48 ms | 401 KiB | 8 Q