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

Multi tool use
Multi tool use
The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP


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()





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











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.

GrJPviU3KOde
NeDOCA10 rBcpIMuNnPY1CluZIh,cDhCgPeoUYg6T3rQ2X49J4ZWqHaJz4fGttyWppRhBij

Popular posts from this blog

Visual Studio Code: How to configure includePath for better IntelliSense results

Spring cloud config client Could not locate PropertySource

Makefile test if variable is not empty