note 64532 deleted from function.key by bjori
| From: | bjori@php.net | Date: | Tue, 18 Apr 2006 07:47:56 +0000 |
| Subject: | note 64532 deleted from function.key by bjori | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-108380@lists.php.net to get a copy of this message | ||
Note Submitter: egingell at sisna dot com
Reason: useless
----
Re:
>> <?php
>> function key_in_array($needle, $haystack) {
>> $haystack = array_flip($haystack);
>> if (in_array($needle, $haystack))
>> {
>> return true;
>> } else {
>> return false;
>> }
>> }
>> ?>
How about this instead?
<?php
function key_in_array($needle, &$haystack) {
if (isset($haystack[$needle]))
{
return true;
} else {
return false;
}
}