How can the array_multisort function in PHP be utilized to sort multiple arrays simultaneously?

To sort multiple arrays simultaneously in PHP, you can use the array_multisort function. This function takes multiple arrays as arguments and sorts them based on the values in the first array provided. This allows you to keep corresponding values in different arrays aligned after sorting.

$names = array("John", "Alice", "Bob");
$ages = array(25, 30, 22);
array_multisort($names, $ages);

// Output sorted arrays
print_r($names);
print_r($ages);