note 42498 deleted from function.is-array by tomsommer

From: Date: Tue, 18 May 2004 22:29:22 +0000
Subject: note 42498 deleted from function.is-array by tomsommer
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-69799@lists.php.net to get a copy of this message
Note Submitter: chuck@gcinet.net ---- This is the best way I have found for figuring out if it is an associative array or not. function is_assoc_array($array) { if (!is_array($array)) return; @eval ("list(\$test) = \$array;"); if (isset($test)) { return 0; // Isn't an assoc array } else { return 1; // Is an assoc array } } This should work as long as list always expects a numeric array :) Hint, Hint, Hint developers, if you change this please add us a real function call ;)

« previous php.notes (#69799) next »