如何计算多维数组中的第二个维度?

时间:2022-02-17 21:35:56

I have an array:

我有一个数组:

    $array[][second][][]

I need to count the numbers of element that they are located in the second box.

我需要计算它们位于第二个框中的元素的数量。

1 个解决方案

#1


0  

you should count this with foreach statement

你应该用foreach语句来计算它。

$count=0;
foreach($array as $counting)
{
count+=$counting['first']['second'];
}

#1


0  

you should count this with foreach statement

你应该用foreach语句来计算它。

$count=0;
foreach($array as $counting)
{
count+=$counting['first']['second'];
}