Sorting an array in PHP based on different values
- by Jimbo
I have an array whose elements are name, reversed_name, first_initial and second_initial. A typical row is "Aaron Smith", "Smith, Aaron", "a", "s". Each row in the array has a first_initial or second_initial value of "a".
I need to display the rows alphabetically but based on the "a" part, so that either the name or reversed_name will be displayed. An example output would be:
Aaron Smith
Abbot, Paul
Adrian Jones
Anita Thompson
Atherton, Susan
I really have no idea how to sort the array this way so any help will be much appreciated!