3v4l.org

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