What are some common pitfalls when sorting arrays in PHP, especially when dealing with multidimensional arrays?

One common pitfall when sorting multidimensional arrays in PHP is not specifying the correct sorting flags when using functions like `array_multisort()`. To ensure proper sorting of multidimensional arrays, you should use the `SORT_NUMERIC` flag when sorting numerical values and the `SORT_STRING` flag when sorting strings.

// Example of sorting a multidimensional array by a specific key with correct sorting flags
$users = [
    ['name' => 'John', 'age' => 30],
    ['name' => 'Jane', 'age' => 25],
    ['name' => 'Alice', 'age' => 35]
];

// Sort the array by the 'age' key in ascending order
array_multisort(array_column($users, 'age'), SORT_ASC, $users);

// Output the sorted array
print_r($users);