Are there any potential pitfalls or limitations when sorting arrays in PHP?

When sorting arrays in PHP, one potential pitfall is that sorting functions may not work as expected if the array contains different data types or nested arrays. To avoid this issue, you can use the `SORT_REGULAR` flag when sorting arrays, which compares elements in a standard way without changing their types.

$array = [10, '20', 30, '40', ['50']];
sort($array, SORT_REGULAR);
print_r($array);