3v4l.org

run code in 300+ PHP versions simultaneously
<?php $arg1 = "['1']"; $arg2 = "['2']"; $arg3 = "['3']"; $_SESSION['1']['2']['3'] = 'zzzz'; function setKey($session_keys, $val) { $current_key = ''; $counter = 0; $prev_step = &$_SESSION; $tmp = &$prev_step; $session_keys_array = explode(':', $session_keys); foreach ($session_keys_array as $key) { if (is_array($tmp[$key])) { $tmp = &$tmp[$key]; var_dump($tmp); } else { $tmp = $val; var_dump($tmp); } } } setKey('1:2:3',5); // var_dump($_SESSION);
Output for git.master, git.master_jit, rfc.property-hooks
array(1) { [2]=> array(1) { [3]=> string(4) "zzzz" } } array(1) { [3]=> string(4) "zzzz" } int(5)

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.82 ms | 401 KiB | 8 Q