note 106077 added to function.is-array
| From: | Alex at osu1 dot php dot net | Date: | Fri, 07 Oct 2011 20:17:20 +0000 |
| Subject: | note 106077 added to function.is-array | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-183719@lists.php.net to get a copy of this message | ||
magentix your associative array with empty check doesn't work, you need to change:
function is_assoc ($arr) {
return (is_array($arr) && (!count($arr) ||
count(array_filter(array_keys($arr),'is_string')) == count($arr)));
}
to
function is_assoc ($arr) {
return (is_array($arr) && (count($arr) &&
count(array_filter(array_keys($arr),'is_string')) == count($arr)));
}
----
Server IP: 69.147.83.197
Probable Submitter: 94.192.140.248
----
Manual Page -- http://www.php.net/manual/en/function.is-array.php
Edit -- https://master.php.net/note/edit/106077
Del: integrated -- https://master.php.net/note/delete/106077/integrated
Del: useless -- https://master.php.net/note/delete/106077/useless
Del: bad code -- https://master.php.net/note/delete/106077/bad+code
Del: spam -- https://master.php.net/note/delete/106077/spam
Del: non-english -- https://master.php.net/note/delete/106077/non-english
Del: in docs -- https://master.php.net/note/delete/106077/in+docs
Del: other reasons-- https://master.php.net/note/delete/106077
Reject -- https://master.php.net/note/reject/106077
Search -- https://master.php.net/manage/user-notes.php