我试图找出第一个索引“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 )
)
)
答案 0 :(得分:1)
我认为你正在寻找的表达是
foreach ($arr as $key => $value)
允许您遍历数组并查看当前正在迭代的键。请参阅documentation。
将此应用于您的阵列,我会说这只是一个写作问题
foreach ($arr as $key => $value)
echo $key . "\n";
获取
EMEA
IL