Changing key of Multidimensional array in PHP

Posted by Thyu on Stack Overflow See other posts from Stack Overflow or by Thyu
Published on 2013-10-18T03:50:36Z Indexed on 2013/10/18 3:53 UTC
Read the original article Hit count: 116

Filed under:

This is my first array

Array
(
   [0] => Array
        (
            [0] => 1
            [1] => Elite
            [2] => Air-Con Bus
            [3] => Monday
        )

    [1] => Array
        (
            [0] => 4
            [1] => KBZ
            [2] => Airplane
            [3] => Wednesday
        )
    [2] => Array
        (
            [0] => 5
            [1] => Yoma
            [2] => Cruise
            [3] => Tuesday
        )
)

I want to be inner array[0] to the outer array key. Like the following array: Can I or not? Please suggest me.

Array(
     [1] => Array
        (
            [0] => 1
            [1] => Elite
            [2] => Air-Con Bus
            [3] => Monday
        )

    [4] => Array
        (
            [0] => 4
            [1] => KBZ
            [2] => Airplane
            [3] => Wednesday
        )

    [5] => Array
        (            
            [0] => 5
            [1] => Yoma
            [2] => Cruise
            [3] => Tuesday
        )
)

© Stack Overflow or respective owner

Related posts about php