note 95684 added to function.is-array
| From: | Anonymous at osu1 dot php dot net | Date: | Fri, 15 Jan 2010 18:26:27 +0000 |
| Subject: | note 95684 added to function.is-array | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-165009@lists.php.net to get a copy of this message | ||
Do not use below code, found in earlier comments:
<?php
function is_assoc($array) {
return (is_array($array) && 0 !== count(array_diff_key($array,
array_keys(array_keys($array)))));
}
?>
It is buggy, and therefore array('1'=>'Yes',
'0'=>'No') is interpreted as NOT associative!
----
Server IP: 69.147.83.197
Probable Submitter: 212.117.1.162
----
Manual Page -- http://www.php.net/manual/en/function.is-array.php
Edit -- https://master.php.net/note/edit/95684
Del: integrated -- https://master.php.net/note/delete/95684/integrated
Del: useless -- https://master.php.net/note/delete/95684/useless
Del: bad code -- https://master.php.net/note/delete/95684/bad+code
Del: spam -- https://master.php.net/note/delete/95684/spam
Del: non-english -- https://master.php.net/note/delete/95684/non-english
Del: in docs -- https://master.php.net/note/delete/95684/in+docs
Del: other reasons-- https://master.php.net/note/delete/95684
Reject -- https://master.php.net/note/reject/95684
Search -- https://master.php.net/manage/user-notes.php