Sometimes our array is dynamically generated, and we don’t know how many dimensions the array is. Now I will introduce to you the PHP method to determine whether the array is one-dimensional, two-dimensional, or multi-dimensional. Friends who need to know more can enter refer to.
Column 1
The code is as follows
|
Copy code
|
||||||||
$al[] = $level; foreach($arr as $v){
aL($v,$al,$level);
}
}
}
aL($arr,$al);
return max($al);
}
?>
Example 2
You can determine whether it is one-dimensional, two-dimensional, or an array of several dimensions:
Previous article:Usage and differences of substr(), mb_substr() and mb_strcut functions_PHP tutorial
Next article:Solution to obtain URL with garbled Chinese characters in PHP_PHP Tutorial
Statement of this Website
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
Latest Articles by Author
Latest Issues
When adding sublime3 to compile system php, use the PHP toolbox, cmd php -v is useless
From 1970-01-01 08:00:00
0
0
0
Related Topics
More>
Popular Recommendations
Popular Tutorials
More>
Latest Downloads
More>
|