如何索引下面的数组,
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
(
)
)
)
答案 0 :(得分:2)
$newarray=array();
foreach ($oldarray as $k=>$v) $newarray[]=array($k=>$v);