首頁 >後端開發 >php教程 >PHP二维数组的表格输出

PHP二维数组的表格输出

WBOY
WBOY原創
2016-06-23 13:28:492083瀏覽

<?php$arr1 = array("nokia" => array('lumia800','lumia900','lumia1520'),"apple" => array('iphone4s','iphone5c','iphone6s'),"msoft" => array('surface1','surface2','surface3'));$arr2 = array(array('lumia800','lumia900','lumia1520'),array('iphone4s','iphone5c','iphone6s'),array('surface1','surface2','surface3'));echo "<table border='1px'>";foreach($arr2 as $key=>$val){echo "<tr>";foreach($val as $detail){echo "<td>".$detail."</td>";}echo "</tr>";}echo "</table>";?>


陳述:
本文內容由網友自願投稿,版權歸原作者所有。本站不承擔相應的法律責任。如發現涉嫌抄襲或侵權的內容,請聯絡admin@php.cn