我有一个挑战将两个数组相乘。这就是我打算做的
Array1 ( [0] => 2 [1] => 2 )
Array2 ( [0] => 8000.00 [1] => 1234.00 )
每次我将其相乘时,它都会将其分解为 4 并返回一个结果
Array ( [0] => 16000 [1] => 16000 [2] => 2468 [3] => 2468 )
但是,当我传递单个数据时,它会正确。这是我的代码,我会很感激我能得到的任何帮助。谢谢
$total = array();
foreach($office_price as $price){
foreach($office_quantity as $quantity){
$total[] = $price * $quantity;
}
}