我有以下代码,但它一次运行一个 foreach 循环。有没有办法让它们同时运行?
foreach($json['orders']['cnr_output_ship_to_header'] as $header)
{
$orders_array[] = $header;
$guests_array[] = $header['guests']['cnr_output_guest_detail'];
$items_array[] = $header['items']['cnr_output_item_detail'];
}
foreach($guests_array as $guests)
{
pdo_insert('cnr_output_guest_detail', (array)$guests);
}
foreach($items_array as $items)
{
pdo_insert('cnr_output_item_detail', (array)$items);
}
foreach($orders_array as $orders)
{
pdo_insert('cnr_output_ship_to_header', (array)$orders);
}