3v4l.org

run code in 300+ PHP versions simultaneously
<?php class foo { } (function(){echo 'foo';})->bindTo(new foo, foo::class)(); echo PHP_EOL; class Wagon { private $name; public function __construct($name) { $this->name = $name; } } class bar { public $wagons; } $obj = new bar(); $obj->wagons = (function (Wagon ...$wagons) { return $wagons; })(new Wagon('Wagon1'), new Wagon('Wagon2')); var_dump($obj->wagons);
Output for git.master, git.master_jit, rfc.property-hooks
foo array(2) { [0]=> object(Wagon)#1 (1) { ["name":"Wagon":private]=> string(6) "Wagon1" } [1]=> object(Wagon)#4 (1) { ["name":"Wagon":private]=> string(6) "Wagon2" } }

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