How To array_intersect_uassoc_insensitive()
<?php
// From the PHP manual
$arrayl = array("a" => "green", "b" => "brown", "c" => "blue", "red");
$array2 = array("a" => "GREEN", "B" => "brown", "yellow", "red");
$arrays = [$arrayl, $array2];
print_r(call_user_func_array("array_intersect_uassoc", [$arrayl, $array2, "strcasecmp"] ));
array_intersect() functions use a direct comparison between the values in the array to make the comparison. When the comparison needs to be case insensitive, then one can use the u version of those functions, to make a case insensitive comparison.
See Also
- array_intersect()
- array_intersect_key()
- array_intersect_ukey()
- array_intersect_assoc()
- array_intersect_uassoc()
- array_intersect_case_insensitive() [Try me]
PHP Features
Last updated: 09 November 2026