3v4l.org

run code in 300+ PHP versions simultaneously
<?php function flatten($arr) { $result = []; foreach ($arr as $key => $value) { if (is_array($value)) { foreach (flatten($value) as $subKey => $scalar) { $result[$key . ':' . $subKey] = $scalar; } } else if (is_scalar($value)) { $result[$key] = $value; } } return $result; } var_dump(['foo' => 123, 'bar' => 456]); var_dump(['foo' => ['bar' => 123, 'baz' => 456]]);
Output for git.master, git.master_jit, rfc.property-hooks
array(2) { ["foo"]=> int(123) ["bar"]=> int(456) } array(1) { ["foo"]=> array(2) { ["bar"]=> int(123) ["baz"]=> int(456) } }

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