How can you efficiently sort an array in PHP based on multiple keys in the subarrays?

When sorting an array in PHP based on multiple keys in the subarrays, you can use the `array_multisort()` function. This function allows you to sort the array based on multiple columns in the subarrays. You need to create separate arrays for each column you want to sort by, then use `array_multisort()` to sort the main array based on these columns.

// Sample array with subarrays
$array = [
    ['name' => 'John', 'age' => 30],
    ['name' => 'Jane', 'age' => 25],
    ['name' => 'Alice', 'age' => 35],
];

// Separate arrays for sorting
foreach ($array as $key => $row) {
    $names[$key] = $row['name'];
    $ages[$key] = $row['age'];
}

// Sort by name and age
array_multisort($names, SORT_ASC, $ages, SORT_ASC, $array);

// Output sorted array
print_r($array);