use the array_sum and array_map function together.
try below solution:
$array = Array ( '0' => Array ( 'num1' => 123, 'num2' => 456, ), '1' => Array ( 'num3' => 789, 'num4' => 147, ), '2' => Array ( 'num5' => 258, 'num6' => 369, 'num7' => 987, ), ); echo $total = array_sum(array_map("count", $array));
Output
7
an alternative way could be:
echo count($array, COUNT_RECURSIVE) - count($array);
source share