我有这个数组
$the_posted = Array
(
0 => Array
(
0 => 1,
1 => 2,
2 => 3,
3 => 4,
),
1 => Array
(
0 => 5,
1 => 6,
2 => 7,
3 => 8,
)
);
我需要修改谁的键。我试图修改数组键
$all_array_keys = array_keys($the_posted);
foreach ( array_keys($the_posted) as $k=>$v )
{
$all_array_keys[$k]= rand();
}
echo '<pre>';
print_r($all_array_keys);
echo "<hr/>";
print_r($the_posted);
echo '<pre>';
我得到这个结果
Array
(
[0] => 25642
[1] => 8731
)
Array
(
[0] => Array
(
[0] => 1
[1] => 2
[2] => 3
[3] => 4
)
[1] => Array
(
[0] => 5
[1] => 6
[2] => 7
[3] => 8
)
)
键的变化不会反映在最终的数组中。我该如何进行这项工作?