3v4l.org

run code in 300+ PHP versions simultaneously
<?php class struct { private $args; function __construct(array $args) { $this->args = $args; } function __invoke(callable $signature = NULL) : array { if ($signature === NULL) return $this->signature(...array_values($this->args)); return $signature(...array_values($this->args)); } } final class Dinosaur extends struct { function signature(int $legs) : array { return get_defined_vars(); } } $two_legs = function(Dinosaur $dino) : Dinosaur { $trex = $dino(); $trex['legs'] = 2; return new Dinosaur($trex); }; var_dump($two_legs(new Dinosaur([0])));
Output for git.master, git.master_jit, rfc.property-hooks
object(Dinosaur)#3 (1) { ["args":"struct":private]=> array(1) { ["legs"]=> int(2) } }

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