php 數組排序

來源:互聯網
上載者:User
Array
  (
  [1000] => Array
  (
  [dist] => 1928.18889545
  [shopid] => 1000
  )
   
  [1001] => Array
  (
  [dist] => 295.558668935
  [shopid] => 1001
  )
   
  [1002] => Array
  (
  [dist] => 2.67680315736
  [shopid] => 1002
  )
   
  [1006] => Array
  (
  [dist] => 668.709406592
  [shopid] => 1006
  )
   
  [1021] => Array
  (
  [dist] => 12953.0495479
  [shopid] => 1021
  )
   
  [1029] => Array
  (
  [dist] => 639.820714898
  [shopid] => 1029
  )
   
  [1031] => Array
  (
  [dist] => 151.348735659
  [shopid] => 1031
  )
   
  [1044] => Array
  (
  [dist] => 883.182182974
  [shopid] => 1044
  )
   
  [1063] => Array
  (
  [dist] => 462.139407729
  [shopid] => 1063
  )
   
  [1071] => Array
  (
  [dist] => 985.98233941
  [shopid] => 1071
  )
   
  [1109] => Array
  (
  [dist] => 886.123349467
  [shopid] => 1109
  )
   
  [1216] => Array
  (
  [dist] => 1391.75026864
  [shopid] => 1216
  )
   
  [1218] => Array
  (
  [dist] => 11.8269564255
  [shopid] => 1218
  )
   
  [1221] => Array
  (
  [dist] => 1072.54743021
  [shopid] => 1221
  )
   
  [1233] => Array
  (
  [dist] => 522.889116546
  [shopid] => 1233
  )
   
  [1241] => Array
  (
  [dist] => 127.093786546
  [shopid] => 1241
  )
   
  [1246] => Array
  (
  [dist] => 2.57192465275
  [shopid] => 1246
  )
   
  [1248] => Array
  (
  [dist] => 724.469047803
  [shopid] => 1248
  )
   
  [1259] => Array
  (
  [dist] => 304.507270814
  [shopid] => 1259
  )
   
  [1261] => Array
  (
  [dist] => 165.811702805
  [shopid] => 1261
  )
   
  [1265] => Array
  (
  [dist] => 1661.77823691
  [shopid] => 1265
  )
   
  [1288] => Array
  (
  [dist] => 485.799046822
  [shopid] => 1288
  )
   
  [1291] => Array
  (
  [dist] => 1023.38260719
  [shopid] => 1291
  )
   
  [1317] => Array
  (
  [dist] => 885.494333595
  [shopid] => 1317
  )
   
  [1321] => Array
  (
  [dist] => 182.446614995
  [shopid] => 1321
  )
   
  )

  • sort($array);//升序排序
  • //rsort($fruits);//降序排序
  • var_dump($array);
  • 聯繫我們

    該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

    如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.