Skip to content

Instantly share code, notes, and snippets.

@kyptov
Created January 30, 2016 06:27
Show Gist options
  • Save kyptov/c9939485aad117a69ea0 to your computer and use it in GitHub Desktop.
Save kyptov/c9939485aad117a69ea0 to your computer and use it in GitHub Desktop.

Revisions

  1. kyptov created this gist Jan 30, 2016.
    15 changes: 15 additions & 0 deletions usort_array.php
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,15 @@
    <?php
    $array = [
    ['ts' => 3],
    ['ts' => 5],
    ['ts' => 1],
    ['ts' => 2],
    ['ts' => 7],
    ['ts' => 0],
    ];

    usort($array, function($a, $b) {
    return $a['ts'] - $b['ts'];
    });

    var_dump($array);