3v4l.org

run code in 300+ PHP versions simultaneously
<?php class foo { static public function test() { var_dump(get_called_class()); } public function testTwo() { var_dump(get_called_class()); } } class bar extends foo { } class abc { function test() { foo::test(); bar::test(); } function testTwo() { foo::testTwo(); bar::testTwo(); } } echo "basic\n"; foo::test(); bar::test(); echo "basic without static declaration\n"; foo::testTwo(); bar::testTwo(); echo "in a class\n"; $abc = new abc(); $abc->test(); echo "in a class without static declaration\n"; $abc->testTwo();
Output for git.master, git.master_jit, rfc.property-hooks
basic string(3) "foo" string(3) "bar" basic without static declaration Fatal error: Uncaught Error: Non-static method foo::testTwo() cannot be called statically in /in/5D2m2:33 Stack trace: #0 {main} thrown in /in/5D2m2 on line 33
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:
57.66 ms | 401 KiB | 8 Q