3v4l.org

run code in 300+ PHP versions simultaneously
<?php function array_replace_key($search, $replace, array $target) { $return = array(); foreach ($target as $key => $val) { if ($search === $key) { $return[$replace] = $val; } else { $return[$key] = $val; } } return $return; } $a = array('a' => 'franz', 'b' => 'cheryl', 'c' => 'samantha'); var_dump(array_replace_key('a', 'bx', $a));
Output for git.master, git.master_jit, rfc.property-hooks
array(3) { ["bx"]=> string(5) "franz" ["b"]=> string(6) "cheryl" ["c"]=> string(8) "samantha" }

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