Php judges the array as a dimension array. Copy the code as follows :? Php *** returns the array dimension * @ param [type] $ arr [description] * @ return [type] [description] * functionarrayLevel ($ arr) {$ alarray (0); function
The code is as follows:
/**
* Returns the array dimension.
* @ Param [type] $ arr [description]
* @ Return [type] [description]
*/
Function arrayLevel ($ arr ){
$ Al = array (0 );
Function aL ($ arr, & $ al, $ level = 0 ){
If (is_array ($ arr )){
$ Level ++;
$ Al [] = $ level;
Foreach ($ arr as $ v ){
AL ($ v, $ al, $ level );
}
}
}
AL ($ arr, $ al );
Return max ($ al );
}
?>
The http://www.bkjia.com/PHPjc/326724.htmlwww.bkjia.comtruehttp://www.bkjia.com/PHPjc/326724.htmlTechArticle code is as follows :? Php/*** return the array dimension * @ param [type] $ arr [description] * @ return [type] [description] */function arrayLevel ($ arr) {$ al = array (0); function...