I have a Laravel project, and I have an array like below.
array:12 [▼
0 => "آبان 1398"
1 => "آذر 1398"
2 => "اردیبهشت 1398"
3 => "اسفند 1397"
4 => "بهمن 1397"
5 => "تیر 1398"
6 => "خرداد 1398"
7 => "دی 1397"
8 => "شهریور 1398"
9 => "فروردین 1398"
10 => "مرداد 1398"
11 => "مهر 1398"
]
How can I sort it by values? For example, all records with 1398 after that 1397.
rsort($array).rsort($array)will sort it in descending order by the entire string, so all the 1398s will be before the 1397s, but it will the 1398 and 1397 groups in descending order according to the rest of the string. Does that work for you, or does the sort need to be more complex?