note 92917 deleted from function.is-array by danbrown

From: Date: Fri, 14 Aug 2009 18:39:02 +0000
Subject: note 92917 deleted from function.is-array by danbrown
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-159483@lists.php.net to get a copy of this message
Note Submitter: MindFreakTheMon ---- <?php /* using PCRE function. useful for big arrays (with over 9000 entries) */ function is_numeric_array(array $array) { return count(preg_grep('/[0-9]+/', array_keys($array))) == count($array); } /* using simple foreach and integer-check function. better for small arrays */ function is_numeric_array(array $array) { foreach($array as $k=>$v) { if(!is_int($k)) { return false; } } return true; }

« previous php.notes (#159483) next »