두 배열 값을 비교하려고합니다. 내가 키 값을 비교하려는 PHP 배열 키 값 비교
$a2 = array('456' => 'match2', '99' => 'match3');
$a3 = array();
처럼 배열 2가
$a1 = array('123' => 'test1', '456' => 'test2', '789' => 'test3');
처럼 내 배열 1이다.
array1
키
array2
키와 일치하는 경우, 새로운 배열에
array1
요소를 밀어
나는이
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];
}
}
사람이 나를 도울 수
? 고마워요!
당신은 [array_intersect_key()]에서 보았다 (http://www.php.net/manual/en/function.array-intersect-key.php)? –
코멘트 섹션에 내 답변을 게시해야한다고 생각하기 시작했습니다. –