返回一个排序数组whitout一个foreach

时间:2016-12-30 09:54:27

标签: php arrays php-5.3

我有这个数组:

Array
(
[0] => Array
    (
        [id] => 1
        [type] => 1
        [s] => 123
    )

[1] => Array
    (
        [id] => 2
        [os_type] => 2
        [token] => fdsfsdfsd
    )

[2] => Array
    (
        [id] => 2
        [type] => 1
        [s] => oidshiufjsd
    )

[3] => Array
    (
        [id] => 1
        [type] => 1
        [s] => sdjfdhskjfdsh
    )

[4] => Array
    (
        [id] => 2
        [type] => 1
        [s] => sdjfhdsfkjds
    )

我想通过密钥type whitout foreach对此数组进行排序。我希望得到类似的东西:

1 => Array(
      [id] => 1
      [s]  => 123
     ),
     .....
2 => Array(
      [id] => 2,
      [s]  => fdsfsdfsd
      )
  ......

这个想法是按类型构建这个数组。请帮助我.. Thx提前和抱歉我的英语

0 个答案:

没有答案