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:
source:php.cn
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
Group MySQL results by ID for looping over
I have a table with flight data in mysql. I'm writing a php code that will group and displ...
From 2024-04-06 17:27:56
0
1
406
Related Topics
More>
Popular Recommendations
Popular Tutorials
More>
Latest Downloads
More>
|