PHP splitting arrays into groups based on one field's value
- by Dan
I have an array containing arrays of names and other details, in alphabetical order. Each array includes the first letter associated with the name.
Array
(
[0] => Array
(
[0] => a
[1] => Alanis Morissette
)
[1] => Array
(
[0] => a
[1] => Alesha Dixon
)
[2] => Array
(
[0] => a
[1] => Alexandra Burke
)
[3] => Array
(
[0] => b
[1] => Britney Spears
)
[4] => Array
(
[0] => b
[1] => Bryan Adams
)
)
I'd like to display them grouped by that first initial, eg:
A
-
Alanis Morissette
Alesha Dixon
Alexandra Burke
B
-
Britney Spears
Bryan Adams
etc...
Is this at all possible?