You can simply execute this:
if (count($myarray) !== count($myarray, COUNT_RECURSIVE)) return true;
else return false;
If the optional mode parameter is set to COUNT_RECURSIVE
(or 1), count() will recursively count the array. This is particularly useful for counting all the elements of a multidimensional array.
If it's the same, means there are no sublevels anywhere. Easy and fast!