array_intersect_key
PHP 5 >= 5.1.0, PHP 7, PHP 8
array_intersect_key - Computes the intersection of arrays using keys for comparison
Example #1 array_intersect_key example
Result: array(2) {
["blue"]=>
int(1)
["green"]=>
int(3)
}
Example #2 of array_intersect_key