最新赞助活动温馨提示:自愿赞助服务器费用,学生和没有工作的整站资源免费下载!
头像

求解数组合并解决方案

来源:http://erdangjiade.com/topic/79840.html 你好,世界。 2017-10-04 21:03浏览(2)

求解数组合并
Array ( [59] =>aa [17] => bb [18] =>cc [69] => dd [21] =>ee [22] => ss [23] => Array ( [0] => 1a[1] =>2a[2] => 3a [3] =>4a [4] => 55 ) [24] =>vv [26] => va [43] => Array ( [0] => 道 [1] =>向 [2] => 圾 [3] => 灯 [4] => 速 [5] => 灯 [6] => 则 ) [53] => 元 [54] => 995 )[1]=>Array ( [59] =>aa [17] => bb [18] =>cc [69] => dd [21] =>ee [22] => ss [23] => Array ( [0] => 1a[1] =>2a[2] => 3a [3] =>4a [4] => 55 ) [24] =>vv [26] => va [43] => Array ( [0] => 道 [1] =>向 [2] => 圾 [3] => 灯 [4] => 速 [5] => 灯 [6] => 则 ) [53] => 元 [54] => 995 )
如何将最后一维合并?
是用foreach遍历时合并吗?如果数据多了会不会卡住?
------解决方案--------------------
foreach($arr as $k=>$v){
if(is_array($v)) $arr[$k] = implode(',', $v);
}
print_r($arr);

------解决方案--------------------
不一定,需判断 $v 是数组后,方可进入 foeach($v as ...

评论0
头像

友情提示:垃圾评论一律封号 加我微信:826096331拉你进VIP群学习群

1 2