此代码执行if和else,任何帮助将不胜感激,谢谢你。
foreach($each_item as $key => $product)
{
foreach($new_item as $key2 => $newproduct)
{
if (in_array($product['product_id'], $newproduct)) {
$this->update_order_items($order_id, $product['product_id'], array(
"quantity" => $newproduct['quantity'],
"price" => $newproduct['price']
));
}
else
{
$this->delete_order_items($order_id, $product['product_id']);
}
}
}
答案 0 :(得分:0)
您能否告诉我们上述代码的结果?
foreach($each_item as $key => $product)
{
foreach($new_item as $key2 => $newproduct)
{
if (in_array($product['product_id'], $newproduct)) {
echo '1';
}
else
{
echo '2';
}
exit;
}
}