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
Try this. loop the 2nd array and extract the value from array1 with using value of array2 as index for array1
foreach ( $array2 as $arr2 ){ $temp[]= $array[ $arr2 ]; } return $temp;