I want to ask about how to replace inner key in a multidimensional array.
I have an multidimensional array :
$array1=
array(array(5000, 6, 325, 3, 3, 517000000),
array( 20000, 5, 217, 5, 3, 1692000000)
);
The second array is
$array2=array(1,2,3,4,5,6);
I expected the new array is
Array(
[0] => Array
(
[1] => 5000
[2] => 6
[3] => 325
[4] => 3
[5] => 3
[6] => 517000000
)
[1] => Array
(
[1] => 20000
[2] => 5
[3] => 217
[4] => 5
[5] => 3
[6] => 1692000000
))
I have tried this code below by another post PHP Replace multidimensional array keys, but I can't assign the value of my array1
foreach($array2 as $array2 ){
for($k=0;$k<sizeof($array2);$k++){
for($l=0;$l<$count;$l++){
$last[$l][$array2] = $array1[$k][$l];
}
$i += $count;
}
}
Thank you
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…