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¶
PHP Features¶
Last updated: 14 July 2026