I'm looking for a simple way/function to tell me if an array contains only other arrays or if there are values contained as well. For example,
$a = array(array(), array(), array())
should end up with a 'true' result but
$b = array(array(), 1, 17)
should end up with a 'false result.
I know I can do the following,
function isArrayOfArrays($a) {
foreach ($a as $value) {
if (!is_array($value))
return false;
}
return true;
}
I'm wondering if there is a more elegant way.