What is the difference between SORT_REGULAR, SORT_NUMERIC, and SORT_STRING options when sorting an array in PHP?
When sorting an array in PHP, the SORT_REGULAR option treats elements as they are without any specific order, SORT_NUMERIC option sorts elements numerically, and SORT_STRING option sorts elements as strings. This allows for more precise control over the sorting process depending on the data type of the elements in the array.
$array = [10, 5, '20', '3', 'apple', 'banana'];
sort($array, SORT_REGULAR);
print_r($array);
sort($array, SORT_NUMERIC);
print_r($array);
sort($array, SORT_STRING);
print_r($array);