1.排序得内容

 array(6) {
[0] => array(12) {
[0] => string(3) "160"
[1] => string(2) "30"
[2] => string(1) "1"
[3] => string(1) "1"
[4] => string(1) "1"
[5] => string(1) "1"
[6] => string(1) "1"
[7] => string(1) "1"
[8] => string(1) "1"
[9] => string(1) "1"
[10] => string(1) "1"
[11] => string(1) "1"
}
[1] => array(12) {
[0] => string(3) "185"
[1] => string(2) "35"
[2] => string(1) "1"
[3] => string(1) "1"
[4] => string(1) "1"
[5] => string(1) "1"
[6] => string(1) "1"
[7] => string(1) "1"
[8] => string(1) "1"
[9] => string(1) "1"
[10] => string(1) "1"
[11] => string(1) "1"
}
[2] => array(12) {
[0] => string(3) "175"
[1] => string(2) "33"
[2] => string(1) "1"
[3] => string(1) "1"
[4] => string(1) "1"
[5] => string(1) "1"
[6] => string(1) "1"
[7] => string(1) "1"
[8] => string(1) "1"
[9] => string(1) "1"
[10] => string(1) "1"
[11] => string(1) "1"
}
[3] => array(12) {
[0] => string(3) "170"
[1] => string(2) "32"
[2] => string(2) "11"
[3] => string(1) "1"
[4] => string(1) "1"
[5] => string(1) "1"
[6] => string(1) "1"
[7] => string(1) "1"
[8] => string(1) "1"
[9] => string(1) "1"
[10] => string(1) "1"
[11] => string(1) "1"
}
[4] => array(12) {
[0] => string(3) "165"
[1] => string(2) "31"
[2] => string(2) "11"
[3] => string(1) "1"
[4] => string(1) "1"
[5] => string(1) "1"
[6] => string(1) "1"
[7] => string(2) "11"
[8] => string(1) "1"
[9] => string(1) "1"
[10] => string(1) "1"
[11] => string(1) "1"
}
[5] => array(12) {
[0] => string(3) "180"
[1] => string(2) "34"
[2] => string(1) "1"
[3] => string(1) "1"
[4] => string(1) "1"
[5] => string(1) "1"
[6] => string(1) "1"
[7] => string(1) "1"
[8] => string(1) "1"
[9] => string(1) "1"
[10] => string(1) "1"
[11] => string(1) "1"
}
}

按照里面的下标为1的排序

2 .方法:

   $sort = array(
'direction' => 'SORT_ASC', //排序顺序标志 SORT_DESC 降序;SORT_ASC 升序
'field' => '1', //排序字段
);
$arrSort = array();
foreach($data_list AS $uniqid => $row){
foreach($row AS $key=>$value){
$arrSort[$key][$uniqid] = $value;
}
}
if($sort['direction']){
array_multisort($arrSort[$sort['field']], constant($sort['direction']), $data_list );
}

3. 结果:

 array(6) {
[0] => array(12) {
[0] => string(3) "160"
[1] => string(2) "30"
[2] => string(1) "1"
[3] => string(1) "1"
[4] => string(1) "1"
[5] => string(1) "1"
[6] => string(1) "1"
[7] => string(1) "1"
[8] => string(1) "1"
[9] => string(1) "1"
[10] => string(1) "1"
[11] => string(1) "1"
}
[1] => array(12) {
[0] => string(3) "165"
[1] => string(2) "31"
[2] => string(2) "11"
[3] => string(1) "1"
[4] => string(1) "1"
[5] => string(1) "1"
[6] => string(1) "1"
[7] => string(2) "11"
[8] => string(1) "1"
[9] => string(1) "1"
[10] => string(1) "1"
[11] => string(1) "1"
}
[2] => array(12) {
[0] => string(3) "170"
[1] => string(2) "32"
[2] => string(2) "11"
[3] => string(1) "1"
[4] => string(1) "1"
[5] => string(1) "1"
[6] => string(1) "1"
[7] => string(1) "1"
[8] => string(1) "1"
[9] => string(1) "1"
[10] => string(1) "1"
[11] => string(1) "1"
}
[3] => array(12) {
[0] => string(3) "175"
[1] => string(2) "33"
[2] => string(1) "1"
[3] => string(1) "1"
[4] => string(1) "1"
[5] => string(1) "1"
[6] => string(1) "1"
[7] => string(1) "1"
[8] => string(1) "1"
[9] => string(1) "1"
[10] => string(1) "1"
[11] => string(1) "1"
}
[4] => array(12) {
[0] => string(3) "180"
[1] => string(2) "34"
[2] => string(1) "1"
[3] => string(1) "1"
[4] => string(1) "1"
[5] => string(1) "1"
[6] => string(1) "1"
[7] => string(1) "1"
[8] => string(1) "1"
[9] => string(1) "1"
[10] => string(1) "1"
[11] => string(1) "1"
}
[5] => array(12) {
[0] => string(3) "185"
[1] => string(2) "35"
[2] => string(1) "1"
[3] => string(1) "1"
[4] => string(1) "1"
[5] => string(1) "1"
[6] => string(1) "1"
[7] => string(1) "1"
[8] => string(1) "1"
[9] => string(1) "1"
[10] => string(1) "1"
[11] => string(1) "1"
}
}

PHP 二位数组按照下标排序的更多相关文章

  1. PHP 之二位数组根据某个字段排序封装

    /** * @param $array * @param $keys * @param string $sort * @return array */ function arraySort($arra ...

  2. java中Arrays.sort()对二位数组进行排序

    int [][]a = new int [5][2]; //定义一个二维数组,其中所包含的一维数组具有两个元素 对于一个已定义的二位数组a经行如下规则排序,首先按照每一个对应的一维数组第一个元素进行升 ...

  3. C++ 出现bug :二位数组的操作运算,求非对角线的元素的和

    编写一个通用程序,求出二位数组(行数和列数必须相等)的非对角线的元素之和,试建立类MATRIX完成上述功能 #include<iostream> using namespace std; ...

  4. php 按照二位数组中某个指定的字段进行排序

    /** * 按照二维数组中某个指定的某个字段进行排序 * @param $array 需要被排序的数组 * @param $flag 排序的标志 1,SORT_DESC 降序 2,SORT_ASC 升 ...

  5. PHP将二位数组按照第二维的某个元素的值进行排序

    例如: //原始数组是这样的,希望能够按照第二维中的run_date升序或者降序进行排序: $arr=array( 0=>array( 'run_date'=>'2017-11-21', ...

  6. shell二位数组——终端字符下降动画

    猜想:Shell支持关联数组,可以利用关联数组模拟二维数组. [验证猜想] #!/bin/bash array[1,1]=1 array[2,1]=2 array[3,1]=3 for i in `s ...

  7. 剑指offer:二位数组中的查找

    准备找实习期间,复习一下数据相关内容,刷刷题. 题目描述: 在一个二维数组中(每个一维数组的长度相同),每一行都按照从左到右递增的顺序排序,每一列都按照从上到下递增的顺序排序.请完成一个函数,输入这样 ...

  8. C# 一维数组 二位数组 多维数组

    什么是数组? 数组是一组变量,就是把一些变量串在一起,放在一块. 数组的作用? 假设有一堆变量,每个变量都有一些程序,那么这堆程序放在一起  程序就会混乱,处理起来有些麻烦,那么数组就是把这些变量放在 ...

  9. php二位数组合并

    转自:http://www.cnblogs.com/losesea/archive/2013/06/14/3134900.html 题目:有以下2个二维数组 1$a=Array(0 => Arr ...

随机推荐

  1. Atitit 热烈庆祝读经器项目圆满完成

    Atitit 热烈庆祝读经器项目圆满完成 1.1. 读经器项目简单介绍 1 1.2. 一万小时定律和十年一个专家定律 1 1.3. 获得加持前景 1 1.4. 核心源码 1 1.5. 项目git 2 ...

  2. 解决AndroidStudio导入项目卡在gradle加载界面

    为了节省排版时间,直接上图了,图片若看不清,可在新标签中打开查看. 文中图片上涉及到的一些链接如下: maven { url 'http://maven.aliyun.com/nexus/conten ...

  3. Fluent动网格【12】:扩散光顺

    扩散光顺是Fluent提供的另外一种常用的网格光顺方法.其基本原理是通过求解扩散方程得到网格节点的运动位移. 扩散光顺基本计算 扩散光顺通过求解 以下扩散方程来设置网格的节点位置. \[ \nabla ...

  4. springmvc 拦截通配符 /** /

    /** 拦截所有 包括 *.js *.css *.png 等等 / 只拦截 /login, /logout, /index等等      

  5. data.frame类型数据如何将第一列值替换为行号

    data.frame类型数据如何将第一列值替换为行号 row.names(data) <- data[, 1]data <- data[, -1]

  6. 【Python】博客信息爬取-微信消息自动发送

    1.环境安装 python -m pip install --upgrade pip pip install bs4 pip install wxpy pip install lxml 2.博客爬取及 ...

  7. 为何GET只发一次TCP连接,POST发两次TCP连接

    GET和POST是HTTP请求的两种基本方法,要说他们的区别,接触过WEB开发的人都能说出一二. 最直观的区别就是GET把参数包含在URL中,POST通过request body传递参数. 你可能自己 ...

  8. python nose 自写插件支持用例带进度

    在自动化测试过程中,当用例很多且要跑很久时,就会出现这样一个问题,不知道当前跑到第几个用例了,还有多少用例要跑,怎么办? 因为用的nose框架,那就看看nose有没有这样的库支持,结果看了一圈,只找到 ...

  9. Mesos和Docker的集成

    摘要: 众所周知,Mesos全面支持Docker.但是这意味着什么呢?在命令行里运行docker run...就可以使用Docker了.还需要做什么?让我们一起研究下Mesos的高级特性——和Dock ...

  10. 深度学习入门之Mnist

    参看Deep learning from scratch,学习到反向传播网络后,把网络调通了,但是训练后损失函数减小,准确率没有变化,和瞎猜一样,是为什么呢?只有在看看各层缺少什么,关键是我的参数和书 ...