-2

我试图找出第一个索引“EMEA”和“IL”的名称,但没有成功。有什么建议么?

Array ( [EMEA] => Array ( 
  [0] => Array ( 
    [disposition] => ANSWERED 
    [numOfCalls] => 8 ) 
  [1] => Array ( 
    [disposition] => BUSY 
    [numOfCalls] => 8 ) 
  [2] => Array ( 
    [disposition] => FAILED 
    [numOfCalls] => 6 ) 
  [3] => Array ( 
    [disposition] => NO ANSWER 
    [numOfCalls] => 4 ) 
  ) 
  [IL] => Array ( 
     [0] => Array ( 
       [disposition] => ANSWERED 
       [numOfCalls] => 6 ) 
     [1] => Array ( 
       [disposition] => BUSY 
       [numOfCalls] => 2 ) 
     [2] => Array ( 
       [disposition] => FAILED 
       [numOfCalls] => 3 ) 
     [3] => Array ( 
       [disposition] => NO ANSWER 
       [numOfCalls] => 2 ) 
     ) 
  )
4

1 回答 1

1

我认为你正在寻找的表达是

foreach ($arr as $key => $value)

它允许您遍历数组并查看当前正在遍历的键。请参阅文档

将此应用于您的数组,我会说这只是一个写作问题

foreach ($arr as $key => $value)
echo $key . "\n";

要得到

EMEA
IL
于 2013-06-09T13:19:02.090 回答