note 68179 deleted from function.array-intersect-key by cmb
| From: | cmb@php.net | Date: | Mon, 02 Nov 2020 21:44:35 +0000 |
| Subject: | note 68179 deleted from function.array-intersect-key by cmb | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-215769@lists.php.net to get a copy of this message | ||
Note Submitter:
----
Here it is a more obvious way to implement the function:
if (!function_exists('array_intersect_key')) {
function array_intersect_key()
{
$arrs = func_get_args();
$result = array_shift($arrs);
foreach ($arrs as $array) {
foreach ($result as $key => $v) {
if (!array_key_exists($key, $array)) {
unset($result[$key]);
}
}
}
return $result;
}
}