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 に答える