0

如何索引下面的数组,

array
(
    [1403847357564066] => Array
        (
            [quantity_request] => 1
            [time_created] => 1339603485
            [variant] => Array
                (
                )
        )

    [1403873546800880] => Array
        (
            [quantity_request] => 1
            [time_created] => 1339602425
            [variant] => Array
                (
                )

        )

)

或者我可以得到,

array(
[0] => array(
      [1403847357564066] => Array
                (
                    [quantity_request] => 1
                    [time_created] => 1339609120
                    [variant] => Array
                        (
                        )

                )
       ),
[1] => array(

            [1403847343435137] => Array
                (
                    [quantity_request] => 1
                    [time_created] => 1339609500
                    [variant] => Array
                        (
                        )

                )
        )
4

1 回答 1

2
$newarray=array();
foreach ($oldarray as $k=>$v) $newarray[]=array($k=>$v);
于 2012-06-13T18:07:59.010 回答