PHP multidimensional array
PHP Multidimensional Array
<?php // 二维数组: $cars = array ( array("Volvo",100,96), array("BMW",60,59), array("Toyota",110,100) ); ?>
PHP - Multidimensional Array
A multidimensional array is an array containing one or more arrays. In a multi-dimensional array, each element in the main array can also be an array, and each element in the sub-array can also be an array. ExampleIn this example, we create a multidimensional array with automatically assigned ID keys: Example<?php $sites = array ( "php"=>array ( "PHP中文网" "http://www.php.cn" ), "google"=>array ( "Google 搜索", "http://www.google.com" ), "taobao"=>array ( "淘宝", "http://www.taobao.com" ) ); print("<pre>"); // 格式化输出数组 print_r($sites); print("</pre>"); ?>