Sort an array by values using a user-defined comparison function.
Source Code
$users = [
['name' => 'John', 'age' => 30],
['name' => 'Jane', 'age' => 25],
['name' => 'Doe', 'age' => 22]
];
usort($users, function($a, $b) { return $a['age'] $b['age']; });
print_r($users);