0

I have an array that containts these values:

Dancelesson 4 years

Dancelesson 5 years

Dancelesson 6 years

Dancelesson 2-3 years

Above is sorted by ascending order, but I want 2-3 years to be first (because 2 is before 4 years). Is there a function to achieve this? (I've tried natsort, natsort, natcasesort etc)

or would I have to create one myself for this purpose? (I guess I could cast the strings in the array to ints and then order them!?)

Ivan Chaer
  • 6,606
  • 1
  • 35
  • 46
bestprogrammerintheworld
  • 5,018
  • 6
  • 36
  • 67

0 Answers0