note 88489 deleted from function.is-array by danbrown

From: Date: Mon, 26 Jan 2009 20:56:07 +0000
Subject: note 88489 deleted from function.is-array by danbrown
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-149803@lists.php.net to get a copy of this message
Note Submitter: mike at van dot lammeren dot net ---- I started this thread in 2003, when I posted as 'mike-php'. There have been a lot of suggestions of questionable quality since then. You may be interested to know that all this time later, I still use the 'vhermecz' version of my original algorithm. /** * Note: * - empty arrays are identified as associative arrays. * - associative arrays whose keys are coincidentally the same as a non-associative array * will be identified as NOT associative * @param array $given * @return boolean true if the given value is an associative array, false otherwise */ function is_assoc_array($given) { return is_array($given) and array_keys($given) !== range(0, sizeof($given)-1); }

« previous php.notes (#149803) next »