php - How can I get the key intersect of two arrays? -
i have 2 arrays shown blow
//array 1 array ( [0] => 223 [1] => 216 ) /array 2 array ( [221] => bakers [220] => construction [223] => information technology [216] => jewellery [217] => photography [222] => retailers )
i want text key (values) of first array matches second array (keys).
expected result:
information technology, jewellery
$result = array(); foreach( $array1 $index ) { $result[] = $array2[ $index ]; } echo implode( ', ', $result );
Comments
Post a Comment