note 57781 added to function.array-intersect-assoc
| From: | StR:stratstrgtdotcjbdotnet at osu1 dot php dot net | Date: | Fri, 14 Oct 2005 00:34:00 +0000 |
| Subject: | note 57781 added to function.array-intersect-assoc | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-96987@lists.php.net to get a copy of this message | ||
To find the keys that are in 2 arrays, without caring of the values:
This is a function i needed, and it also returns the values of the first array
<?php
function array_key_intersect(&$a, &$b) {
$array = array();
while (list($key,$value) = each($a)) {
if (isset($b[$key]))
$array[$key] = $value;
}
return $array;
}
?>
----
Manual Page -- http://www.php.net/manual/en/function.array-intersect-assoc.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+57781
Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+57781&report=yes&reason=added+to+the+manual
Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+57781&report=yes&reason=bad+code
Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+57781&report=yes&reason=spam
Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+57781&report=yes&reason=useless
Delete: non-english -- http://master.php.net/manage/user-notes.php?action=delete+57781&report=yes&reason=non-english
Delete: already in docs -- http://master.php.net/manage/user-notes.php?action=delete+57781&report=yes&reason=already+in+docs
Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+57781&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+57781&report=yes
Search -- http://master.php.net/manage/user-notes.php