PHP - 2D数组 - 循环数组键并检索它们的值?

Cra*_*der 5 php arrays loops

我有一个输出如下的数组:

1 => 
array
  'quantity' => string '2' (length=1)
  'total' => string '187.90' (length=6)

2 => 
array
  'quantity' => string '2' (length=1)
  'total' => string '2,349.90' (length=8)
Run Code Online (Sandbox Code Playgroud)

我想循环遍历每个数组键并检索与它们相关的3个值的集合,类似这样(这不起作用):

foreach( $orderItems as $obj=>$quantity=>$total)
{
    echo $obj;
    echo $quantity;
    echo $total;
}
Run Code Online (Sandbox Code Playgroud)

有人能够就如何实现这一目标给出一些建议,甚至是一个更好的方式让我去完成这项任务.任何与此相关的信息,包括可能涵盖此内容的教程链接,都将不胜感激.谢谢!!

Gav*_*vin 5

foreach( $orderItems as $key => $obj)
{
    echo $key;
    echo $obj['quantity'];
    echo $obj['total'];
}
Run Code Online (Sandbox Code Playgroud)

使用上面的.