How can you sort an array in PHP based on multiple attributes?

When sorting an array in PHP based on multiple attributes, you can use `usort()` function along with a custom comparison function. The comparison function should compare the desired attributes in the order of priority and return the result accordingly. This allows you to sort the array based on multiple attributes in a customized way.

// Sample array to be sorted based on multiple attributes
$users = [
    ['name' => 'Alice', 'age' => 30],
    ['name' => 'Bob', 'age' => 25],
    ['name' => 'Alice', 'age' => 25],
];

// Custom comparison function to sort by name and then age
usort($users, function($a, $b) {
    if ($a['name'] == $b['name']) {
        return $a['age'] - $b['age'];
    }
    return $a['name'] <=> $b['name'];
});

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