alireza mm alireza mm - 2 months ago 7
PHP Question

How I can count second dimension in multi-dimensional array?

I have an array:

$array[][second][][]


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

Answer

you should count this with foreach statement

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