note 58822 deleted from function.is-array by tularis

From: Date: Sun, 09 Oct 2011 09:25:36 +0000
Subject: note 58822 deleted from function.is-array by tularis
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-183738@lists.php.net to get a copy of this message
Note Submitter: ryanyoder at canby dot com ---- this is my attempt at writing a function that would check for a multi dimentional array. where $dim is the number of dimentions you are checking for and $array is of course the variable that is being check. i dont know if there's a better way out there, but this is what i do. <?php function is_multi_array($array,$dim) { if(($dim==1)&&(is_array($array))) { return 1; } foreach($array as $level2) { if(is_multi_array($level2,$dim-1)) { return 1; } } return 0; } ?>

« previous php.notes (#183738) next »