I am trying to compare two array value. My array1 is like
$a1 = array('123' => 'test1', '456' => 'test2', '789' => 'test3');
array2 is like
$a2 = array('456' => 'match2', '99' => 'match3');
$a3 = array();
I want to compare the key value. If array1 key matches array2 key, push array1 element to a new array
I have
for($i=0; $i < count($a1); $i++){
//i am not sure how to write my codes heree......
if($a1[$i]==a2[$i]{
$a3[]=a1$[$i];
}
}
Can someone help me out on this? Thanks a lot!