note 63780 added to function.is-array

From: Date: Thu, 30 Mar 2006 14:28:03 +0000
Subject: note 63780 added to function.is-array
Groups: php.notes 
Request: Send a blank email to php-notes+get-107034@lists.php.net to get a copy of this message
And here is another variation for a function to test if an array is associative. Based on the idea by mot4h. <?php function is_associative($array) { if (!is_array($array) || empty($array)) return false; $keys = array_keys($array); return array_keys($keys) !== $keys; } ?> ---- Server IP: 83.137.20.120 Probable Submitter: 193.172.179.122 ---- X-Spam-Status: No, hits=3.1 required=5.0 tests=DATE_MISSING,FROM_NO_LOWER autolearn=no version=2.64 ---- Manual Page -- http://www.php.net/manual/en/function.is-array.php Edit -- http://master.php.net/note/edit/63780 Del: integrated -- http://master.php.net/note/delete/63780/integrated Del: useless -- http://master.php.net/note/delete/63780/useless Del: bad code -- http://master.php.net/note/delete/63780/bad+code Del: spam -- http://master.php.net/note/delete/63780/spam Del: non-english -- http://master.php.net/note/delete/63780/non-english Del: in docs -- http://master.php.net/note/delete/63780/in+docs Del: other reasons-- http://master.php.net/note/delete/63780 Reject -- http://master.php.net/note/reject/63780 Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#107034) next »