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,980
  • 1
  • 38
  • 48
bestprogrammerintheworld
  • 5,417
  • 7
  • 43
  • 72

0 Answers0