public static function count_r($mixed) { $totalCount = 0; foreach ($mixed as $temp) { if (is_array($temp)) { $totalCount += utility::count_r($temp); } else { $totalCount += 1; } } return $totalCount; }