Check for multidimensional array

Views: 9 Last modified: September 17th, 2011 Comments: 0

This snippet will return true is the parameter is a multidimensional array, else it will return false. It will also return false if the parameter is not a array.

Example of use:

if (is_multi_array($a))
      echo 'Multi!';
else
    echo 'Not multi!';
function is_multi_array($arr)
{
	if (!is_array($arr)) return false;
	$multi = array_filter($arr, 'is_array');
	return count($multi) > 0 ? true : false;
}
VN:F [1.9.13_1145]
Rating: 0.0/10 (0 votes cast)
VN:F [1.9.13_1145]
Rating: 0 (from 0 votes)

    Mail this!

    To: From:Sum {4+7} =  
    Anything to add ?

        You must be logged in to post a comment.