3v4l.org

run code in 300+ PHP versions simultaneously
<?php class TestClass{ private $name; public function __construct($name){ $this->$name=$name; } public function changeName($name){ $this->name=$name; } public function displayName(){ echo $this->name; } } $testCls= new TestClass('Dmitry Fucintv'); $testCls->changeName=function($name){ $this->name='Other name'; }; call_user_func($testCls->changeName, 'Some name'); $testCls->displayName();
Output for git.master, git.master_jit, rfc.property-hooks
Deprecated: Creation of dynamic property TestClass::$Dmitry Fucintv is deprecated in /in/evtgj on line 6 Deprecated: Creation of dynamic property TestClass::$changeName is deprecated in /in/evtgj on line 17 Fatal error: Uncaught Error: Using $this when not in object context in /in/evtgj:18 Stack trace: #0 /in/evtgj(20): {closure}('Some name') #1 {main} thrown in /in/evtgj on line 18
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:
39.56 ms | 401 KiB | 8 Q