note 75411 added to function.array-key-exists
| From: | alishahnovin at hotmail dot com | Date: | Mon, 28 May 2007 17:47:33 +0000 |
| Subject: | note 75411 added to function.array-key-exists | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-126984@lists.php.net to get a copy of this message | ||
Seems the array_key_exists can't find a key in a multidimensional array...
Here's my fix...
<?php
function multi_array_key_exists($needle, $haystack) {
foreach ($haystack as $key=>$value) {
if ($needle==$key) {
return true;
}
if (is_array($value)) {
multi_array_key_exists($needle, $value);
}
}
return false;
}
?>
----
Server IP: 66.207.199.35
Probable Submitter: 204.244.149.125
----
Manual Page -- http://www.php.net/manual/en/function.array-key-exists.php
Edit -- https://master.php.net/note/edit/75411
Del: integrated -- https://master.php.net/note/delete/75411/integrated
Del: useless -- https://master.php.net/note/delete/75411/useless
Del: bad code -- https://master.php.net/note/delete/75411/bad+code
Del: spam -- https://master.php.net/note/delete/75411/spam
Del: non-english -- https://master.php.net/note/delete/75411/non-english
Del: in docs -- https://master.php.net/note/delete/75411/in+docs
Del: other reasons-- https://master.php.net/note/delete/75411
Reject -- https://master.php.net/note/reject/75411
Search -- https://master.php.net/manage/user-notes.php