To count items in multidem. array with specific key you can use:
$groups = [
[
'id' => 1,
'name' => 'group 1',
'items' => ['a','b','c','d'],
],
[
'id' => 2,
'name' => 'group 2',
'items' => ['e','f','g'],
]
];
$items_total = array_sum(array_map(function($v){return count($v['items']);},$groups)); // Result is 7.