For example:
Array
(
[0] => Array
(
[id] => 1
[name] => Test
[slug] => test
[services] => Array
(
[0] => Array
(
[name] => test
)
[1] => Array
(
[name] => test
)
[2] => Array
(
[name] => test
)
[3] => Array
(
[name] => test
)
)
)
[1] => Array
(
[id] => 1
[name] => Test
[slug] => test
[services] => Array
(
[0] => Array
(
[name] => test
)
[1] => Array
(
[name] => test
)
[2] => Array
(
[name] => test
)
[3] => Array
(
[name] => test
)
)
)
This is simply dummy data, however I want to count the amount of services that are inside each array but I'm looking for an efficient way.
Now the way I was going to do this was:
foreach($arrayAbove as $array){
$i = 0;
foreach($array['services'] as $array){
$i++;
}
}
Is there a better way to do this?