note 93651 deleted from function.is-array by danbrown

From: Date: Mon, 21 Sep 2009 14:08:56 +0000
Subject: note 93651 deleted from function.is-array by danbrown
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-160887@lists.php.net to get a copy of this message
Note Submitter: Laurent ---- After some testing of all those functions you've posted, here's the fastest way to check if an array is associative. Hope this helps anyone who, as myself, was wondering which was the best solution... public static function is_associative2($array){ if (is_array($array)) { $i=0; foreach ($array as $k=>$v) { if ($k !== $i) return true; $i++; } } return false; }

« previous php.notes (#160887) next »