PHP array_uintersect () and array_uintersect_assoc () instance tutorial
Definition and usage
The array_uintersect () function compares two or more arrays in the user's function and returns an array containing content from the first array if the user's function permits it. The user's function compares the array value and returns a value. If the returned value is 0, the array should contain this content.
Syntax
Array_uintersect (array1, array2, array3., function)
Parameter description: required by array1. The first array, the other will be required with array2. An array is optional relative to the first array array3. An array is a functional requirement relative to the first array. Note: You can compare the first array with an array, or you like it. Note: Only value is used for comparison. For example, <? Php
Function myfunction ($ v1, $ v2)
{
If ($ v1 ===$ v2)
{
Return 0;
}
If ($ v1> $ v2) return 1;
{
Return-1;
}
Return 1;
}
$ A1 = array ("a" => "Cat", "B" => "Dog", "c" => "Horse ");
$ A2 = array (1 => "Cat", 2 => "Dog", 3 => "Fish ");
Print_r (array_uintersect ($ a1, $ a2, "myfunction "));
?> Output result. array ([a] => Cat [B] => Dog) to see the array_uintersect_assoc () instance tutorial definition and usage. The array_uintesect_assoc () function compares two or more arrays, whether it is in built-in functions and in user functions, then return an array containing content from the first array if it permits its functions. The built-in functions are the key. The user's function compares the value and returns a value. If the returned value is 0, the array should contain this content. The array_uintersect_assoc (array1, array2, array3. .., function) parameter describes the requirements of array1. The first array, the other will be required with array2. An array is optional relative to the first array array3. An array is a functional requirement relative to the first array. Note: You can compare the first array with an array, or you like it. Note: For comparison, the key is to use the built-in functions and values for user functions. For example, <? Php
Function myfunction ($ v1, $ v2)
{
If ($ v1 ===$ v2)
{
Return 0;
}
Return 1;
}
$ A1 = array ("a" => "Cat", "B" => "Dog", "c" => "Horse ");
$ A2 = array ("a" => "Cat", "B" => "Horse", "c" => "Dog ");
Print_r (array_uintersect_assoc ($ a1, $ a2, "myfunction "));
?> Output result. Array ([a] Cat)