3v4l.org

run code in 500+ PHP versions simultaneously
<?php function method_a(&$links, ?bool $indexable) { $links[] = [ 'indexable === ' => as_string($indexable), // very long list... and: ...(null !== $indexable ? ['indexable' => $indexable] : []), ]; } function method_b(&$links, ?bool $indexable) { $link = [ 'indexable === ' => as_string($indexable), // very long list... and: ]; if (null !== $indexable) { $link['indexable'] = $indexable; } $links[] = $link; } function as_string($v) { if (null === $v) { return 'null'; } if (false === $v) { return 'false'; } if (true === $v) { return 'true'; } } $links = []; method_a($links, null); method_a($links, true); method_a($links, false); var_dump($links); $links = []; method_b($links, null); method_b($links, true); method_b($links, false); var_dump($links);
Output for git.master, git.master_jit, rfc.property-hooks
array(3) { [0]=> array(1) { ["indexable === "]=> string(4) "null" } [1]=> array(2) { ["indexable === "]=> string(4) "true" ["indexable"]=> bool(true) } [2]=> array(2) { ["indexable === "]=> string(5) "false" ["indexable"]=> bool(false) } } array(3) { [0]=> array(1) { ["indexable === "]=> string(4) "null" } [1]=> array(2) { ["indexable === "]=> string(4) "true" ["indexable"]=> bool(true) } [2]=> array(2) { ["indexable === "]=> string(5) "false" ["indexable"]=> bool(false) } }

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:
20.21 ms | 1176 KiB | 4 Q