国产av日韩一区二区三区精品,成人性爱视频在线观看,国产,欧美,日韩,一区,www.成色av久久成人,2222eeee成人天堂

PHP Beginner's Introduction to Multidimensional Arrays

php Multidimensional array

The value in one array can be another array, and the value of another array can also be an array. In this way, we can create a two-dimensional or three-dimensional array:

Create a two-dimensional array

Format:

array(

array(1,2,3,4,5),

array(6,7,8,9,10)

)

Example 1:

<?php
	$arr = array(
			array(1,2,3,4,5),
			array(6,7,8,9,10)
		);

	echo "<pre>";
	print_r($arr);
	echo "</pre>";
?>

Example 2: Create a multidimensional array

<?php 
header("Content-type: text/html; charset=utf-8");//設(shè)置編碼 
$sites = array ( 
        "php"=>array ( 
            "php中文網(wǎng)", 
            "http://miracleart.cn" 
        ), 

        "google"=>array ( 
            "Google 搜索", 
            "http://www.google.com" 
        ), 

        "taobao"=>array( 
            "淘寶", 
            "http://www.taobao.com" 
        ) 
); 
print("<pre>"); // 格式化輸出數(shù)組 
print_r($sites); 
print("</pre>"); 
?>

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


Continuing Learning
||
<?php echo "hello world"; ?>
submitReset Code