//You can determine whether it is a one-dimensional, two-dimensional, or several-dimensional array:
Function getmaxdim($arr){
if(!is_array($arr)){
return 0;
}else{
$dimension = 0;
foreach($arr as $item1)
{
$t1=$this->getmaxdim($item1);
if($t1>$dimension){$dimension = $t1;}
}
return $dimension+1;
}
}
//Verified and ready to use.
//Test
$arr=array('yiyi'=>1212,'haha'=>array('heihei'=>array(array("a")),"b"));
echo getmaxdim($arr);
//Result 4