本教程是对将三维数组转成二维数组,先来看看三维数组:
$result = array( 0 => array( 0 => array( "name" => "dunqie", "url" => "www.dunqie.com", ), 1 => array( "name" => "dunqie", "url" => "www.dunqie.com", ) ), 1 => Array( 0 => array( "name" => "dunqie", "url" => "www.dunqie.com", ), ) );
使用下面代码进行循环重组:
$newarr=array(); foreach($result as $value){ foreach($value as $v){ $newarr[]=$v; } } print_r($newarr);
输出:
博主专注于Z-BLOG网站搭建、网站优化以及电脑故障排查、重装、优化、维修系统等,QQ/WX:2126245521(请注明来意)
Copyright © 2020-2023 Jack作品 Reserved.
Powered By Z-Blog Sitemap | 蜀ICP备2023025269号-1
Processed : 0.028 SQL : 14
本文暂无评论 - 欢迎您