LoginSignup
1
3

More than 5 years have passed since last update.

多次元配列のソート

Last updated at Posted at 2016-12-06
$array = [
    array(
        'id'        => 0,
        'track_num' => 7,
        'title'     => 'ベィスドロップ・フリークス',
        'artist'    => 'かめりあ feat. ななひら'
    ),
    array(
        'id'        => 1,
        'track_num' => 1,
        'title'     => 'CHRONO DIVER -NORNIR-',
        'artist'    =>  'L.E.D.'
    ),  
    array(
        'id'        => 2,
        'track_num' => 3,
        'title'     => 'illuminate',
        'artist'    => 'Sota Fujimori'
    ), ];

array_multisort(array_column($array, 'track_num'), SORT_ASC, $array);

参照元
http://qiita.com/shy_azusa/items/54dadc55e3e71cde1445

1
3
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
3