Jump to content


Photo

Sorting array in alpabetical order, words containg "-"


  • Please log in to reply
2 replies to this topic

#1 IMakeLousyCode

IMakeLousyCode
  • New Members
  • Pip
  • Newbie
  • 6 posts

Posted 11 September 2006 - 07:46 PM

Hi,
Is there an easy way to sort an array(asort) so that a word containing "-" is sorted correctly, for instance

A-list
is after Alist

with only asort, A-list is always first!

Thanks

#2 ober

ober
  • Staff Alumni
  • Advanced Member
  • 5,337 posts
  • LocationEast Coast, USA

Posted 11 September 2006 - 07:48 PM

That's because alphabetically, it is correct.  - is before l in the sorting algorithm.

Info: PHP Manual


#3 IMakeLousyCode

IMakeLousyCode
  • New Members
  • Pip
  • Newbie
  • 6 posts

Posted 11 September 2006 - 08:09 PM

OK thanks, I will keep it this way then, if it even alphabetically correct!  ;D




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users