What are the best practices for sorting arrays in PHP based on specific criteria like alphabetical order or numerical weight?

When sorting arrays in PHP based on specific criteria like alphabetical order or numerical weight, you can use the built-in functions `asort()` for alphabetical sorting and `arsort()` for reverse alphabetical sorting. For numerical sorting, you can use `sort()` for ascending order and `rsort()` for descending order.

// Sorting an array alphabetically
$array = ['apple', 'banana', 'cherry'];
asort($array);
print_r($array);

// Sorting an array numerically
$numbers = [5, 2, 8, 1];
sort($numbers);
print_r($numbers);