What are common pitfalls when sorting arrays in PHP?

One common pitfall when sorting arrays in PHP is not specifying the sorting method. By default, PHP's `sort()` function sorts arrays in ascending order, but if you need to sort in descending order, you need to use `rsort()`. Another pitfall is not preserving the keys of the array when sorting, which can be done using `asort()` and `arsort()` for associative arrays.

// Example of sorting an array in descending order
$numbers = [5, 2, 8, 1, 9];
rsort($numbers);
print_r($numbers);

// Example of sorting an associative array while preserving keys
$fruits = ['apple' => 3, 'banana' => 2, 'cherry' => 5];
arsort($fruits);
print_r($fruits);