我想转换这个数组:
Array
(
[0] => Array
(
[group] => site
[key] => date_format
[value] => %d %B %Y - %H:%M:%S
)
[1] => Array
(
[group] => site
[key] => description
[value] => blah
)
[2] => Array
(
[group] => site
[key] => keywords
[value] =>
)
[3] => Array
(
[group] => pages
[key] => permalink
[value] => <page>(/<subpage>)
)
[4] => Array
(
[group] => system
[key] => plugins
[value] => a:1:{i:0;s:5:"pages";}
)
[5] => Array
(
[group] => site
[key] => title
[value] => some title
)
)
......对此...
Array
(
[system] => Array
(
[plugins] => a:1:{i:0;s:5:"pages";}
)
[site] => Array
(
[date_format] => %d %B %Y - %H:%M:%S
[description] => blah
[keywords] =>
[title] => some title
)
[pages] => Array
(
[permalink] => <page>(/<subpage>)
)
)
如果没有foreach和任何其他循环,有没有办法做到这一点?
答案 0 :(得分:3)
不,你不能。
这种微观优化将毫无意义。只需编写一个简单的foreach循环并停止尝试发明方形轮。