Copy Code code as follows:
<?php
/**
* * An overview of an array
1. The nature of the array: manage and manipulate a set of variables, batch processing
2. Arrays are composite types
3. An array can store data of any length. You can also store any type of data
4. Array can complete other language data structure function (linked list, queue, Stack, collection Class)
**
Two. Classification of arrays
There are multiple units in the array, (units are called elements)
Each element is made up of subscript "keys" and values
When you access an element individually, you are accessing the element by subscript "key"
1. One-dimensional array, two-dimensional array, three-dimensional array ... Multidimensional arrays
(An array of arrays in which there are other arrays in the array)
There are two types of arrays in 2.php
Indexed array: is subscript "key" is an index of sequential integers
Associative array: Subscript is a string as an index
Subscript (integer, string) only these two
*
Three. Array Multiple declaration modes
1 assigning values directly to array elements
If the index subscript is not given, it will be indexed starting from 0.
If you give the index subscript, then the next one will be 1 from the biggest start.
If the preceding subscript appears, if the assignment is to reassign the previous element
D mixed-declaration time indexes and associations do not affect each other (without affecting the declaration of index subscript)
2 using the array () function
A default is an indexed array
B. If you make a subscript for an associative array and an indexed array, use the key => value
C Use "," split between multiple members;
3 using a different function declaration
File ();
*
*
*
*
**/
Echo $arr [5]
Indexed arrays
$user []=1;
$user [9]= "John"
$user [0]=10;
$user [3]= "Nan";
$info =array (
"$user" =array (
$user [0]
Array ("1", "John", Ten, "Nan"),
$user [1]
Array ("2", "Lisi", Ten, "Nan"),
$user [2]
Array ("3", "Wangwu", Ten, "Nan"),
),
"$score" =array (
$user [0]
Array ("1", "John", Ten, "Nan"),
$user [1]
Array ("2", "Lisi", Ten, "Nan"),
$user [2]
Array ("3", "Wangwu", Ten, "Nan"),
),
"$connect" =array (
$user [0]
Array ("1", "John", Ten, "Nan"),
$user [1]
Array ("2", "Lisi", Ten, "Nan"),
$user [2]
Array ("3", "Wangwu", Ten, "Nan"),
),
};
$user [][]=1;
$user [][]=1;
$user [][]=1;
$user [][]=1;
$user [][]=1;
?>