Skip to content

Instantly share code, notes, and snippets.

@phenix-factory
Last active December 1, 2015 16:03
Show Gist options
  • Select an option

  • Save phenix-factory/ba8c91c7de10b54f4c30 to your computer and use it in GitHub Desktop.

Select an option

Save phenix-factory/ba8c91c7de10b54f4c30 to your computer and use it in GitHub Desktop.
PHP: Tester si un tableau est multidimensionel
<?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