I have an array with 100 values(array1). I have another array with 8 values(array2). I want to take the values from array2 and use them as keys and extract the values in array1
something like this one:
function combine($array1, $array2) {
$array3 = array();
foreach ($array2 as $key => $value) { //loop through all entries of array2
//get the entry of array1 that corresponds to the value of array2's entry
if (isset($array1[$value]) {
$array3[$key] = $array1[$value]
}
}
return $array3;
}
I haven't tested it but it should give you something for thought.