I. Overview of Arrays 1. the essence of arrays: managing and operating a group of variables. batch processing 2 arrays are composite types. 3 arrays can store data of any length, you can also store any type of data. 2. there are two types of array index arrays in array classification 2PHP: subscript is sequence 1. Array Overview 1. the essence of arrays: managing and operating a group of variables, batch processing 2. array is composite type 3. the array can store data of any length or any type of data. 2. array classification. there are two array index arrays in PHP: the subscript is an ordered integer and the index is associated with the array: the subscript is a string as an index example: index array [php] $ user [0] = 1; $ user [1] = "kobe"; $ user [2] = 10; $ user [3] = "mac"; $ user [4] = "kobe@bb.com"; echo'
'; print_r($user); echo '
'; Example: join array [php] $ user = array ("id" => 1, "name" => "kobe ", "age" => 10,100 => "mac", "kobe@bbb.com"); for ($ I = 0; $ I <20; $ I ++) $ user [] = $ I; echo'
'; print_r($user); echo '
'; Php multi-dimensional array [php] $ User = array ('Zhang 3', 93), array ('li 4', 80), array ('Wang 5 ', 98); php array element traversal [php] "Kobe", 1 => "mac-t", 2 => "lin"); // use the first method to traverse the array foreach ($ arr as $ value) {echo "Value: $ value;";} echo"
"; // Use the second method to traverse the array foreach ($ arr as $ key => $ value) {echo" Key: $ key; Value: $ value; ";}?> [Php] Array (5 => 100, 3 => 120, 4 => 30), "ar2" => array (4 => "three", 9 => "four ", 1 => "five"); // traverses the array foreach ($ array as $ v1) {foreach ($ v1 as $ v2) {print "$ v2/n" ;}}?>