Introduction
In this article I will explain the two important functions of array, Array_intersect_assoc() and Array_intersect_uassoc() in PHP.
The Array_intersect_assoc() function creates an array containing keys and values. This function computes the intersection of an array and an additional check is to compare the data with a callback function.
Syntax
|
Array_intersect_assoc($array1, $array2, "Array"); |
| Parameter | Description |
| Array1 | The array with master values to check. |
| Array2 | An array to compare values against. |
| Array | A variable list of arrays to compare. |
This function returns an associative array containing all the values in array1 that are present in all of the arguments.
Example
<?php
$array1 = array
(
"a" => "Tom",
"b" => "Horry",
"c" => "grush", "joney"
);
$array2 = array
(
"a" => "Tom",
"b" => "teenu",
"grush", "joney"
);
$result_array = array_intersect_assoc($array1, $array2



Join the conversation! Your thoughts help the community grow.