How can php quickly compare the same values that exist in two arrays

topic description

get two arrays. The first array is $arr1

string(4)"10000","10003","10004","10006"

then calculate the length of the arr2 $arr2

$longth2 = count ( $arr2 );

for ( $I = 0; $I < $longth2 ; $I PP) {

}

but I don"t know how to compare the results next.

< H1 > the desired result is < / H1 >

$arr2 each element exists in the $arr1 location, the number will only appear once, no idea, ask for advice! Thank you

Php
Apr.08,2022

array_intersect()  // 
array_intersect_assoc()  // 
array_intersect_key() // 

array_intersect


use the function array_intersect function

example:

$a1 = [1,2,3,4,5,6,7,8,9];
$a2 = [3,6];
$r = array_intersect($a1, $a2);
$r = [2 => 3, 5 => 6]; $a1

array_intersect()

array_intersect ()


array_intersect -calculates the intersection of the array
array array_intersect (array $array1, array $array2 [, array $...])
array_intersect () returns an array that contains all the values that appear in array1 as well as in all other parameter arrays. Note that the key name remains the same.

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b36592-2b783.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b36592-2b783.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?