note 94920 deleted from function.is-array by danbrown

From: Date: Thu, 03 Dec 2009 14:16:25 +0000
Subject: note 94920 deleted from function.is-array by danbrown
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-163544@lists.php.net to get a copy of this message
Note Submitter: Phil Lello ---- Another is_assoc(): function is_assoc($array) { return is_int(array_keys($array)[0]); } Note: Haven't tested this exact function, but have used is_int inside a foreach. It is reasonable to assume that if a user is using integers as keys, then it isn't an associative array. Could also loop through all keys to make sure, but that seems redundant.

« previous php.notes (#163544) next »