<?php //1.PHP-两维数组 $cars=array ( array("Volvo",22,18), array("BMW",15,13), array("Saab",5,2), array("Land Rover",17,15) ); echo $cars[0][0].":库存:".$cars[0][1].":已售:".$cars[0][2]; echo "<br>"; echo $cars[1][0].":库存:".$cars[1][1].":已售:".$cars[1][2]; echo "<br>"; echo $cars[2][0].":库存:".$cars[2][1].":已售:".$cars[3][2]; echo "<hr>"; echo "<table border='1' cellpadding='10' style='border-collapse: collapse;'>"; echo "<tr>"; echo "<td>品牌</td>"; echo "<td>库存</td>"; echo "<td>已售</td>"; echo "</tr>"; for ($row=0; $row < 4; $row++) { echo "<tr>"; for ($col=0; $col < 3; $col++) { echo "<td>"; echo $cars[$row][$col]; echo "</td>"; } echo "</tr>"; } echo "</table>"; ?>