//可以判断是一维的,还是二维的,或是几维的数组:
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;
}
}
//验证过可以使用.
//测试
$arr=array('yiyi'=>1212,'haha'=>array('heihei'=>array(array("a")),"b"));
echo getmaxdim($arr);
//结果 4
http://www.bkjia.com/PHPjc/762029.htmlwww.bkjia.comtruehttp://www.bkjia.com/PHPjc/762029.htmlTechArticle//可以判断是一维的,还是二维的,或是几维的数组: function getmaxdim($arr){ if(!is_array($arr)){ return 0; }else{ $dimension = 0; foreach($arr as $item1) { $t1=$thi...
Statement:The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn