$result =
Array
(
[kpi] => calls
[team] => team1
[content] => Array
(
[0] => Array
(
[name] => June
[last_name] => Fernandez
[user_name] => junef
[result] => 19
)
[1] => Array
(
[name] => Juan
[last_name] => Fernandez
[user_name] => juanf
[result] => 19
)
)
Array
(
[kpi] => emails
[team] => team2
[content] => Array
(
[0] => Array
(
[name] => May
[last_name] => Fernandez
[user_name] => mayf
[result] => 19
)
[1] => Array
(
[name] => July
[last_name] => Fernandez
[user_name] => july
[result] => 19
)
)
//////
foreach($result as $teams){
print_r(next($teams));
}
什么都不返回 在每个循环中,我想选择数组的下一个键和值。
答案 0 :(得分:0)
只需使用索引
foreach ($result as $i => $teams) {
if ($i+1 < count($result)) {
print_r($result[$i+1]);
}
}
答案 1 :(得分:0)
<?php
$transport = array('foot', 'bike', 'car', 'plane');
$mode = current($transport); // $mode = 'foot';
$mode = next($transport); // $mode = 'bike';
$mode = next($transport); // $mode = 'car';
$mode = prev($transport); // $mode = 'bike';
$mode = end($transport); // $mode = 'plane';
?>