我有一个从POST数据中获取的数组
Array
(
[date_from] => Array
(
[0] => 01/10/2015
...
)
[date_to] => Array
(
[0] => 01/11/2015
...
)
[price_eur] => Array
(
[0] => 8
...
)
[price_usd] => Array
(
[0] => 9
...
)
)
我想将其转换为:
Array
(
[0] => Array
(
['date_from'] => 01/10/2015
['date_to'] => 01/11/2015
['price_eur'] => 8
['price_usd'] => 9
)
...
)
如何转换这个php关联数组?
答案 0 :(得分:1)
刚刚解决了这个问题。让我知道它是怎么回事
foreach ($original as $key => $arr){
foreach ($arr as $x => $y){
$new[$x][$key] = $y
}
}