3v4l.org

run code in 300+ PHP versions simultaneously
<?php class MethodTest { public function nonStaticFunction() { MethodTest::runTest(); } public function __call($name, $arguments) { var_dump($this); // Note: value of $name is case sensitive. echo "Calling object method '$name' " . implode(', ', $arguments). "\n"; } /** As of PHP 5.3.0 */ public static function __callStatic($name, $arguments) { var_dump($this); // Note: value of $name is case sensitive. echo "Calling static method '$name' " . implode(', ', $arguments). "\n"; } } $obj = new MethodTest; $obj->runTest('in object context'); MethodTest::runTest('in static context'); $obj->nonStaticFunction();
Output for git.master, git.master_jit, rfc.property-hooks
object(MethodTest)#1 (0) { } Calling object method 'runTest' in object context Fatal error: Uncaught Error: Using $this when not in object context in /in/rTJ07:20 Stack trace: #0 /in/rTJ07(30): MethodTest::__callStatic('runTest', Array) #1 {main} thrown in /in/rTJ07 on line 20
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:
67.99 ms | 401 KiB | 8 Q