配列を繰り返さなくても可能ですか?
$arr = array(
'section1' => array(
5 => array(1, 2, 3),
25 => array(4, 5),
34 => array(10, 12),
),
'section2' => array(
45 => array(1, 42, 3),
64 => array(10, 2, 5, 95),
),
'section3' => array(
5 => array(1, 2, 3, 5, 2),
25 => array(4, 5, 14),
34 => array(17),
),
);
$count = 0;
foreach($arr as $section)
foreach($section as $subsection)
foreach($subsection as $entries)
$count++;
echo $count; // 23
それは機能しますが、いくつかの要素を数えるためだけに配列全体を反復処理したくありません...