note 35681 added to function.is-array

From: Date: Wed, 10 Sep 2003 21:05:42 +0000
Subject: note 35681 added to function.is-array
Groups: php.notes 
Request: Send a blank email to php-notes+get-56039@lists.php.net to get a copy of this message
Still another way that might be slower on bigger arrays but surer to identify between an asociative and a sequential array is this: function is_assoc($array) { if(! is_array($array)) return false; //Not an array at all foreach($array as $key => $value) { if(is_string($key)) return true; } return false; } ---- Manual Page -- http://www.php.net/manual/en/function.is-array.php Edit Note -- http://master.php.net/manage/user-notes.php?action=edit+35681 Delete Note -- http://master.php.net/manage/user-notes.php?action=delete+35681&report=yes Reject Note -- http://master.php.net/manage/user-notes.php?action=reject+35681&report=yes

« previous php.notes (#56039) next »