How to sort array after combine with specification key is name and value alphabetical in php

Multi tool use


How to sort array after combine with specification key is name and value alphabetical in php
I have some problem with sort data array by alphabetical
I've read about the sort in the following link
PHP 5 Sorting Arrays
And here I have tried some functions and not as expected, look at the following picture
Click Here
But my question is what if i want to sort array from second key then sort alphabetically
Sample Array
[0] => Array (
[id] => 46759
[nama] => Albino
)
[1] => Array (
[id] => 46772
[nama] => Saputra
)
[2] => Array (
[id] => 46710
[nama] => Soni Putra
)
[3] => Array (
[id] => 46760
[nama] => Abian
)
And i want result sort by "nama" so result of that's array like this
- Abian
- Albino
- Saputra
- Soni Putra
I try using sort()
or asort()
with many array but the letter "A" is still some that are not sorted according to the order of the letters, is there any other solution to solve this problem ?
sort()
asort()
By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.
You can start with php.net/manual/en/function.usort.php to build a custom sorting callback, within your function you can interrogate the 'nama' array key and perform a strcmp or attempt to sort using php.net/manual/en/function.array-multisort.php
– Scuzzy
1 min ago