如何将数组值拆分为新数组?

时间:2013-10-20 17:46:44

标签: php arrays

如何将接收到的数组值拆分成新数组?

因此:

[["+","+","+"],["-","+","+"],["*","+","+"],["\/","+","+"],

到此:

["+"],["+"],["+"],["-"],["+"],["+"],["*"],["+"],["+"],

有人可以帮助我吗?

1 个答案:

答案 0 :(得分:1)

通过循环来展平你的数组

$aFlattened = array();
foreach($aOriginalArray AS $aOperators){
   $aFlattened = array_merge($aFlattened, $aOperators);
}