3v4l.org

run code in 500+ PHP versions simultaneously
<?php class ComplicatedConstructor { public function __construct( public readonly int $integer, public readonly float $float, public readonly bool $boolean, public readonly string $string, private ?\Closure $closure = null, public readonly float|string|null $optional = 'optional', ) {} } $outOfOrderArray = [ 'optional' => 'The optional', 'string' => 'The string', 'float' => (float) '42.5', 'integer' => 9001, 'boolean' => !true, ]; var_dump(new ComplicatedConstructor(...$outOfOrderArray));
Output for git.master_jit, git.master
object(ComplicatedConstructor)#1 (6) { ["integer"]=> int(9001) ["float"]=> float(42.5) ["boolean"]=> bool(false) ["string"]=> string(10) "The string" ["closure":"ComplicatedConstructor":private]=> NULL ["optional"]=> string(12) "The optional" }

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:
49.57 ms | 580 KiB | 4 Q