Return an sort array whitout an foreach

40 Views Asked by At

I have this array :

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
    )

I wabt to sort this array by the key type whitout foreach. I want to get something like that :

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

The idea is to build this array by type. Please help me.. Thx in advance and sorry for my english

0

There are 0 best solutions below