Javatpoint Logo
Javatpoint Logo

PHP array_uintersect() function

The array_uintersect() is an inbuilt function in PHP. It is used to compute the intersection of two or more arrays depending on the values. The first array values are compared with all the other arrays with the help of an user-defined function, and the matches are returned. This function was introduced in PHP 5.0.

Syntax

Parameters

Parameter Description Is compulsory
array1 Array to compare from. compulsory
array2 Array to compare against. compulsory
array3 More arrays to compare against. Optional
Value_compare_function Comparison function name. compulsory

Return

The array_uintersect( ) function returns an array containing the entries from array1 that are present in all of the other arrays.

Example 1

Output:

Array
(
    [d] =>jmeter
)

Example 2

Output:

Array
(
    [a] => java
    [b] => c
)

Example 3

Output:

Array
(
    [a] => java
    [b] =>php
    [0] => python
)

Example 4

Output:

Array
(
    [1] => 53
    [2] => 43
)





Help Others, Please Share

facebook twitter pinterest