Home >Backend Development >PHP Tutorial >PHP method to determine whether an array is one-dimensional, two-dimensional, or multi-dimensional_PHP tutorial
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:
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 Previous article:Usage and differences of substr(), mb_substr() and mb_strcut functions_PHP tutorialNext article:Usage and differences of substr(), mb_substr() and mb_strcut functions_PHP tutorial Related articlesSee more |