You can βpromoteβ second-level elements to first-level elements through call_user_func_array () . And while array_merge () re-indexes the array, array_replace () does not save the source keys, which make it single-line:
$a = call_user_func_array('array_replace', $a);
Test:
<?php $a = array ( array (2 => ' one@example.com '), array (4 => ' two@example.com '), array (3908 => ' twenty@example.com '), array (2548 => ' eleven@example.com '), array (3099 => ' ten@example.com '), array (5283 => ' six@example.com '), ); $a = call_user_func_array('array_replace', $a); var_dump($a);
source share