fork download
  1. <?php
  2. $a = array(array('idC','usernameC'), array('idA','usernameA'), array('idB','usernameB'));
  3. $id = array();
  4. foreach ($a as $key => $row)
  5. {
  6. $id[$key] = $row[0];
  7. }
  8. array_multisort($id, SORT_ASC, $a);
  9.  
  10. print_r($a);
Success #stdin #stdout 0.02s 52432KB
stdin
Standard input is empty
stdout
Array
(
    [0] => Array
        (
            [0] => idA
            [1] => usernameA
        )

    [1] => Array
        (
            [0] => idB
            [1] => usernameB
        )

    [2] => Array
        (
            [0] => idC
            [1] => usernameC
        )

)