Count total number of items in nested arrays in PHP

Today I was working on some code that had arrays structured like this: I needed to calculate the total number of items in the nested arrays. I didn’t find a PHP function to help me with that but I came up with this idea:

Published
Categorized as PHP