Home >Backend Development >PHP Problem >How to create a multidimensional array in php
Multidimensional array
(Recommended tutorial: php graphic tutorial)
Multidimensional array contains one or more arrays array. In a multidimensional array, each element in the main array can also be an array, and each element in the subarray can also be an array.
Example:
<?php $arr = array( "taobao"=>array( "淘宝" ), "jingdong"=>array( "京东" ), "meituan"=>array( "美团" ) ); print_r($arr); ?>
(Learning video recommendation: php video tutorial)
Running results:
Array ( [taobao] => Array ( [0] => 淘宝 ) [jingdong] => Array ( [0] => 京东 ) [meituan] => Array ( [0] => 美团 ) )
View Web page source code:
The above is the detailed content of How to create a multidimensional array in php. For more information, please follow other related articles on the PHP Chinese website!