How does PHP handle sorting arrays with case sensitivity and how can this be managed effectively?
When sorting arrays in PHP, the default behavior is case-sensitive sorting. To manage this effectively and perform case-insensitive sorting, you can use the `SORT_STRING` flag along with the `SORT_FLAG_CASE` flag in the `sort()` function. This will allow you to sort arrays without considering the case of the values.
$array = ['Apple', 'banana', 'cherry', 'apple'];
sort($array, SORT_STRING | SORT_FLAG_CASE);
print_r($array);