3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Foo { public $elements = array(); public function __construct() { $stdObj = new stdClass; $stdObj->name = 'foo1'; $stdObj->active = false; $this->elements[] = $stdObj; } public function getElementByName($name) { foreach($this->elements as $elm) { if ($elm->name == $name) { return $elm; } } } public function test( ){ return $this->elements; } } $myFoo = new Foo(); $myFoo->getElementByName('foo1')->active = true; var_dump($myFoo->test());
Output for git.master, git.master_jit, rfc.property-hooks
array(1) { [0]=> object(stdClass)#2 (2) { ["name"]=> string(4) "foo1" ["active"]=> bool(true) } }

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:
50.3 ms | 401 KiB | 8 Q