PHP数组转化有关问题
程序员文章站
2022-06-12 11:06:06
...
PHP数组转化问题
Array
(
[0] => Array
(
[0] => user-
[1] => notice-
)
[1] => Array
(
[0] => user-
[1] => calendar-
[2] => calendar-
)
[2] => Array
(
[0] => notice-
[1] => calendar-
)
)
想要的效果
Array([0]=>'user-notice',[1]=>'user-calendar-calendar',[2]=>'user-calendar')
------解决方案--------------------
Array
(
[0] => Array
(
[0] => user-
[1] => notice-
)
[1] => Array
(
[0] => user-
[1] => calendar-
[2] => calendar-
)
[2] => Array
(
[0] => notice-
[1] => calendar-
)
)
想要的效果
Array([0]=>'user-notice',[1]=>'user-calendar-calendar',[2]=>'user-calendar')
------解决方案--------------------
- PHP code
foreach($arr as $v) $ar[]=substr(join('',$v),0,-1); print_r($ar);相关文章
相关视频