note 68179 deleted from function.array-intersect-key by cmb

From: 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; } }

« previous php.notes (#215769) next »