3v4l.org

run code in 300+ PHP versions simultaneously
<?php $path = 'foo/bar/baz'; $root = array('foo' => array('bar' => array('baz' => 'something'))); function bla(&$root, $path, $value) { $paths = explode('/', $path); $current = &$root; foreach ($paths as $path) { if (isset($current[$path])) { $current = &$current[$path]; } else { return null; } } return $current[$value] = $value; } bla($root, $path, '123'); var_dump($root);
Output for git.master, git.master_jit, rfc.property-hooks
Warning: Only the first byte will be assigned to the string offset in /in/iUm08 on line 19 array(1) { ["foo"]=> array(1) { ["bar"]=> array(1) { ["baz"]=> string(124) "something 1" } } }

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:
39.98 ms | 402 KiB | 8 Q