Answer the question
In order to leave comments, you need to log in
Create array when comparing 2D array to 1D array?
Hello.
there is an array A:
$A[0]['url']='http://google.com/';
$A[0]['title']='Google';
$A[1]['url']='http://yandex.com/';
$A[1]['title']='Yandex';
$B[0]="http://yandex.com";
$B[1]="http://yahoo.com"
$С[0]['url']='http://google.com/';
$С[0]['title']='Google';
for($i=0; $i < count($A);$i++){
for($j=0; $j<count($B);$j++){
Answer the question
In order to leave comments, you need to log in
$c = [];
foreach($a as $one_a){
if(in_array($one_a['url'],$b)){
$c[] = $one_a;
}
}
print_r($c);
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question