Jump to content

how to order the usernames out of a table by the alphbet


BillyBoB

Recommended Posts

a note about sort:  it doesn't sort the items alphabetically as one would expect, even if you specify comparison as strings.  in the case that you want array items sorted as a human would alphabetically sort them, use natsort() or natcasesort() (the latter being a case-insensitive version of the natural sort).

and yes, i know this post has strayed off-topic, but i figured i'd point it out while sort() was being mentioned.
Link to comment
Share on other sites

i couldn't really tell, it was a little erratic.  i had an array of filenames, of which a few started with numbers, others with upper case and others with lower case.  i believe it processed them in the order of number in numeric order, upper case in alpha order, lowercase in alpha order.  i was using sort($array, SORT_STRING).

i ended up using natcasesort(), and it fixed the issue.
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.