3v4l.org

run code in 300+ PHP versions simultaneously
<?php $array = array( "a" => "xxx", "b" => "xxx", "c" => array( "g" => "xxx", "a" => "xxx", "h" => "xxx", ), "d" => "xxx", "e" => array( "i" => array( "a" => "xxx", "k" => array( "l" => "xxx", "b" => "xxx", ), ), "j" => "xxx", ), "f" => "xxx", 'h' => array( 'p' => 'xxx', 'n' => 'xxx' ) ); function remove_dup_keys(&$array, &$keys = array()) { foreach ($array as $key => &$value) { if (in_array($key, $keys)) { unset($array[$key]); } else { $keys[] = $key; } } foreach ($array as $key => &$value) { if (is_array($value)) { remove_dup_keys($value, $keys); } } } remove_dup_keys($array); print_r($array);
Output for git.master, git.master_jit, rfc.property-hooks
Array ( [a] => xxx [b] => xxx [c] => Array ( [g] => xxx ) [d] => xxx [e] => Array ( [i] => Array ( [k] => Array ( [l] => xxx ) ) [j] => xxx ) [f] => xxx [h] => Array ( [p] => xxx [n] => xxx ) )

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:
27.79 ms | 406 KiB | 5 Q