我有一个可能包含重复值的平面关联数组。
Array (
[for-juniors] => product_category
[for-men] => product_category
[coats] => product_category
[for-women] => product_category
[7-diamonds] => brand
)
我需要重组数据以将原始值存储为新键,并将原始键推入与新键关联的子数组中。
array(
'product_category' => array(
'for-juniors',
'for-men',
'coats',
'for-women'
),
'brand' => array(
'7-diamonds'
)
);