How can PHP be used to compare arrays with case-insensitive values?

When comparing arrays with case-insensitive values in PHP, we can use the array_map function along with strtolower to convert all values to lowercase before comparing them. This ensures that the values are compared without considering their case sensitivity.

$array1 = ['Apple', 'Banana', 'Orange'];
$array2 = ['apple', 'banana', 'orange'];

$compareArrays = array_map('strtolower', $array1) == array_map('strtolower', $array2);

if($compareArrays){
    echo "Arrays are equal (case-insensitive)";
} else {
    echo "Arrays are not equal (case-insensitive)";
}