Jump to content

Lectrician

Members
  • Content Count

    35
  • Joined

  • Last visited

Community Reputation

0 Neutral

About Lectrician

  • Rank
    Member

Profile Information

  • Gender
    Not Telling
  1. That's great, thank-you. I had kind of got there, but kept trying this and wondered why it would not work: <<INCORRECT CODE>> uasort($usersdata, function($1, $2) { return strcasecmp($1, $2); }); I also left my asort un-commented directy below the new code, so the new code was doing it's job, and then the asort was obliterating it's work! Twit.
  2. I have an array as below, and would like to sort it alphabetically by username. I know in the order shown below, asort works, but what if the username key is not the first? Any ideas on the best ways? Thanks :-) usersdata = array( [12345] = array( [username] => "Toby", => "toby@toby.com", [permissions] => "1,2,3,4" ) [12346] = array( [username] => "Tom", => "tom@tom.com", [permissions] => "5,6,7,8" ) [12347] = array( [username] => "Mable", => "mable@olddear.com", [permissions] => "1,2,3,4" ) [12348] = array( [username] => "Twit", => "twit@twit.com", [permissions] => "1,2,3,4,5,6,7" ) )
×
×
  • 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.