在 array_walk 函数中获取当前索引
Get current index in array_walk function
$A = ["0" => "a", "1" => "b", "2" => "c"];
$B = ["0" => "aa", "1" => "bb", "2" => "cc"]
array_walk($A,function($item) use($B){
$temp[] = $item;
$temp[] = $B[?];
});
如何填写?多于?如何获取array_walk中的当前索引?
如果我理解正确的话,类似的东西会起作用
$A = ["0" => "a", "1" => "b", "2" => "c"];
$B = ["0" => "aa", "1" => "bb", "2" => "cc"]
array_walk($A,function($item, $key) use($B){
$temp[] = $item;
$temp[] = $B[$key];
});
$A = ["0" => "a", "1" => "b", "2" => "c"];
$B = ["0" => "aa", "1" => "bb", "2" => "cc"]
array_walk($A,function($item) use($B){
$temp[] = $item;
$temp[] = $B[?];
});
如何填写?多于?如何获取array_walk中的当前索引?
如果我理解正确的话,类似的东西会起作用
$A = ["0" => "a", "1" => "b", "2" => "c"];
$B = ["0" => "aa", "1" => "bb", "2" => "cc"]
array_walk($A,function($item, $key) use($B){
$temp[] = $item;
$temp[] = $B[$key];
});