$array = array('A', 'B', 'C', 'D', 'E', 'F', 'G');
$newArray = array();
array_walk($array, function ($v, $k) use (&$array, &$newArray) {
$newArray[$k] = $v;
unset($array[$k]);
});
var_dump($array, $newArray);
// Результат:
array (size=3)
1 => string 'B' (length=1)
3 => string 'D' (length=1)
5 => string 'F' (length=1)
array (size=4)
0 => string 'A' (length=1)
2 => string 'C' (length=1)
4 => string 'E' (length=1)
6 => string 'G' (length=1)
<?
$array = array('A', 'B', 'C', 'D', 'E', 'F', 'G');
$arrayForWalking = $data;
$newArray = array();
array_walk($arrayForWalking, function ($v, $k) use (&$array, &$newArray) {
$newArray[$k] = $v;
unset($array[$k]);
});
var_dump($array, $newArray);