note 58822 added to function.is-array

From: Date: Thu, 17 Nov 2005 06:25:18 +0000
Subject: note 58822 added to function.is-array
Groups: php.notes 
Request: Send a blank email to php-notes+get-98683@lists.php.net to get a copy of this message
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. 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; } ---- Manual Page -- http://www.php.net/manual/en/function.is-array.php Edit -- http://master.php.net/manage/user-notes.php?action=edit+58822 Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+58822&report=yes&reason=added+to+the+manual Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+58822&report=yes&reason=bad+code Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+58822&report=yes&reason=spam Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+58822&report=yes&reason=useless Delete: non-english -- http://master.php.net/manage/user-notes.php?action=delete+58822&report=yes&reason=non-english Delete: already in docs -- http://master.php.net/manage/user-notes.php?action=delete+58822&report=yes&reason=already+in+docs Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+58822&report=yes Reject -- http://master.php.net/manage/user-notes.php?action=reject+58822&report=yes Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#98683) next »