3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Foo { private $bar1 = 'a'; private $bar2 = 'b'; public function Update($updateInfo) { $this->$updateInfo['property'] = $updateInfo[$updateInfo['property']]; } } $objFoo = new Foo(); $updateInfo['bar1'] = 'newVal'; $updateInfo['property'] = 'bar1'; $objFoo->Update($updateInfo); var_dump($objFoo);
Output for git.master, git.master_jit, rfc.property-hooks
Warning: Array to string conversion in /in/sI3AE on line 9 Deprecated: Creation of dynamic property Foo::$Array is deprecated in /in/sI3AE on line 9 object(Foo)#1 (3) { ["bar1":"Foo":private]=> string(1) "a" ["bar2":"Foo":private]=> string(1) "b" ["Array"]=> array(1) { ["property"]=> string(6) "newVal" } }

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:
60.57 ms | 406 KiB | 5 Q