0
如何使用數組映射修改以下數組。到目前爲止,我也無法達到想要的結果,所以這裏是我的問題:使用array_map修改array array php
轉換這樣的:
Array
(
[Open+Sans:300,300italic,regular,italic,600,600italic,700,700italic,800,800italic] => Open Sans
[Roboto:100,100italic,300,300italic,regular,italic,500,500italic,700,700italic,900,900italic] => Roboto
[Oswald:300,regular,700] => Oswald
)
到
Array
(
array('label' => 'Open Sans','value' => 'Open+Sans:300,300italic,regular,italic,600,600italic,700,700italic,800,800italic'),
array('label' => 'Roboto','value' => 'Roboto:100,100italic,300,300italic,regular,italic,500,500italic,700,700italic,900,900italic'),
array('label' => 'Oswald','value' => 'Oswald:300,regular,700'),
);
而止跌't ['array_flip'](http://php.net/array_flip)就夠了嗎?使用['foreach'](http://php.net/foreach)來創建子數組。 – mario