I have the following two arrays:
$array_one = array('colorZero'=>'black', 'colorOne'=>'red', 'colorTwo'=>'green', 'colorThree'=>'blue', 'colorFour'=>'purple', 'colorFive'=>'golden'); $array_two = array('colorOne', 'colorTwo', 'colorThree');
I want an array from $array_one that contains only key-value pairs whose keys are members of $ array_two (either by creating a new array or removing the rest of the elements from $array_one )
How can i do this?
I looked at array_diff and array_intersect , but they compare values ββwith values, not the values ββof one array with the keys of another.
source share