note 110567 deleted from function.is-array by googleguy

From: Date: Wed, 07 Nov 2012 20:45:46 +0000
Subject: note 110567 deleted from function.is-array by googleguy
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-191798@lists.php.net to get a copy of this message
Note Submitter: filakhtov at gmail dot com ---- Easiest way to check if array is associative <source>function is_assoc (array $input) { for ($i = 0; $i < count ($input); $i++) { if (!isset ($input[$i])) { return TRUE; } } return FALSE; }</source> This is not the fastest solution, but it detects arrays with "holes" and report them as associative...

« previous php.notes (#191798) next »