PHP array_uintersect() Function

What is array_uintersect() Function?


The "array_uintersect()" function computes the intersection of arrays, compares elements by a callback function.



In the above syntax "array1" and "array2" are compared for values in "function" ,then returns an array of elements of "array1".

Example :

function funct1($x1,$x2)
if ($x1===$x2)
return 0;
if ($x1 > $x2) return 1;
return -1;
return 1;
$b=array(1 =>"Orange",2 =>"Guava", 3 =>"Cherry");
Result :

Array ( [a]=> Orange [b]=> Guava );

In the above example both arrays are compared for values in "funct1", the intersecting values of "$a" is returned in an array.

PHP Topics

Ask Questions

Ask Question