I have an array of users, and I want to sort them alphabetically according to their first_names. But the thing is I am keeping first_name, last_name in another array of the array elements.
Let me explain with the code:
$users = [
[
'id' => 1,
'username' => 'asd',
'info' => ['first_name' => 'John', 'last_name' => 'Doe']
],
[
'id' => 2,
'username' => 'martin',
'info' => ['first_name' => 'Martin', 'last_name' => 'Brown']
]
];
I want to sort this $users array according to the values of the first_name.
I couldn't find any solutions, maybe it's because I couldn't be able to understand the logic of the array_filter, array_map, or any other array functions that I can use.
Any help would be really helpful to me.