Answer the question
In order to leave comments, you need to log in
Comparing two array values and outputting data?
Good afternoon, in general, the story is like this, I display some information on the page. In one of the values of the $data array, an array is written - $arr2. I'm trying to compare its values with the $arr1 array. If at least one value matches, information should be displayed. I'm trying to do it like this. I hope for your help.
$arr1 = array(1, 2, 3);
foreach($result as $data) {
foreach($result_tags as $data_tags) {
$arr2 = explode(',', $data_tags['id']);
// здесь их нужно сравнить
for($i = 0; $i < count($arr1); $i++) {
if(array_search($arr1[$i], $arr2) !== false) { echo 'какая-то информация'; }
}
}
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question