N
N
nikkon822019-10-13 13:38:26
Twig
nikkon82, 2019-10-13 13:38:26

How to display a list of cities, sorted by blocks A - B - C?

Good afternoon!
There is a table in the database (for example):
id fias_id name letter
1 3326 Abakan A
2 3486 Almetyevsk A
3 4761 Barnaul B
4 2786 Belgorod B
5 4314 Vladimir V
6 3734 Volgograd V
Unload an array in - $cities
How to display a sorted list of cities in a twig template by letter blocks (well, or by the first letter) ??
Those. like this:
And
Abakan
Almetyevsk
B
Barnaul
Belgorod
C
Vladimir
Volgograd

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question