What is the function in PHP that can be used to sort multiple associative arrays simultaneously?

When dealing with multiple associative arrays in PHP, you can use the array_multisort() function to sort them simultaneously based on one or more criteria. This function takes multiple arrays as arguments and sorts them in the same order, maintaining the key-value associations within each array.

// Sample associative arrays to be sorted simultaneously
$array1 = array("John" => 25, "Jane" => 30, "Alice" => 20);
$array2 = array("John" => "Developer", "Jane" => "Designer", "Alice" => "Manager");

// Sorting both arrays based on the values of the first array
array_multisort($array1, $array2);

// Output the sorted arrays
print_r($array1);
print_r($array2);