Last active
December 1, 2015 16:03
-
-
Save phenix-factory/ba8c91c7de10b54f4c30 to your computer and use it in GitHub Desktop.
PHP: Tester si un tableau est multidimensionel
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| /** | |
| * Tester si un tableau est multidimensionel | |
| * Voir http://stackoverflow.com/a/145348 | |
| * | |
| * @param array $a | |
| * @access public | |
| * @return bool | |
| */ | |
| function is_array_multi($a) { | |
| foreach ($a as $v) { | |
| // Si un des éléments du tableau est un tableau | |
| // alors c'est un tableau multidimensionel | |
| if (is_array($v)) return true; | |
| } | |
| return false; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment