【发布时间】:2013-10-29 03:07:39
【问题描述】:
如何将接收到的数组值拆分成一个新数组?
因此:
[["+","+","+"],["-","+","+"],["*","+","+"],["\/","+","+"],
到这里:
["+"],["+"],["+"],["-"],["+"],["+"],["*"],["+"],["+"],
有人可以帮我吗?
【问题讨论】:
-
带有循环或array_merge。
-
这不是拆分,而是展平。
-
非常感谢@LightnessRacesinOrbit!这解决了我的问题
-
@vdhmartijn:我有我的时刻
-
你可以使用正则表达式:$str ='[["Z","A","B"],["-","+","+"],["* ","+","+"],["\/","+","+"],'; preg_match_all("/[\"|']([^][\"]+)[\"|']/i", $str, $matches); $matches[1] 是你的新数组 print_r($匹配[1]);