What is the purpose of using array_multisort in PHP and how does it relate to the issue discussed in the thread?

Issue: The thread discusses the need to sort a multidimensional array in PHP based on a specific key within the inner arrays. Solution: One way to solve this issue is by using the array_multisort function in PHP. This function allows you to sort multiple arrays or a multidimensional array based on one or more related columns.

// Sample multidimensional array
$users = array(
    array('id' => 1, 'name' => 'John', 'age' => 30),
    array('id' => 2, 'name' => 'Jane', 'age' => 25),
    array('id' => 3, 'name' => 'Alice', 'age' => 35)
);

// Sort the $users array based on the 'age' key in ascending order
array_multisort(array_column($users, 'age'), SORT_ASC, $users);

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