1、目的:将下面类型数组转换成模板循环打印二维数组
数组库一维数组:
模板要求循环二维数组:
2、代码:
header("Content-type: text/html; charset=utf-8"); $aa = array(\'小明\',\'小红\',\'小强\',\'小芳\',\'小徐\'); //一维数组 $bb = array(\'聪明\',\'可爱\',\'健康\',\'美丽\',\'帅气\'); $cc = array(\'174cm\',\'162cm\',\'179cm\',\'158cm\',\'188cm\'); foreach($aa as $k=>$v){ foreach($bb as $k2=>$v2){ foreach($cc as $k3=>$v3){ if($k==$k2&&$k2==$k3){ $DDDD[$k] = array(\'price_name\'=>$v,\'price_amount\'=>$v2,\'price_num\'=>$v3); } } } } echo "<pre>"; print_r($DDDD);