There are three ways to define arrays in PHP, namely:
<? PHP // The first method is created with the keyword array. $username Array ("Demo1", "Demo2", "Demo3", "Demo4");
<? PHP // The second method is to create an array by declaring a variable directly, adding brackets to the right of the variable $usrename Array (); $username [0]= "AAA"; $username [1]= "BBB"; $username [2]= "CCC"; Print_r ($username);
<?PHP/*Range () Prototype: * Array range (mixed $start, mixed $limit [, number $step = 1]) * Parameter Description: * First value of start sequence 。 The limit sequence ends at the value of limit. Step if you give the step value, it will be used as the step value between the units. Step should be positive. If not specified, step defaults to 1. * Manual Description: * range-Create an array containing the specified range of cells **///the third way to create this is to use a function (range) to create the array$number=Range(0, 10);//creates an array of numbers//print_r ($number);/*results * Array ([0] = 0 [1] = 1 [2] = 2 [3] = 3 [4] = 4 [5] = 5 [6] = 6 [7] = 7 [8] => ; 8 [9] = 9 [ten] = ten)*///We can also specify his stride size for this set of arrays created .$number=Range(0, 10,2);//create an array of a set of numbersPrint_r($number);/*results * Array ([0] = 0 [1] = 2 [2] = 4 [3] = + 6 [4] = 8 [5] = +)*///You can also create a set of alphabetic arrays:$eng=Range(' A ', ' Z ');Print_r($eng);/*results * Array ([0] = a [1] = b [2] = + c [3] + d [4] = e [5] + f [6] = g [7] = h [8] => ; I [9] = J [Ten] + k [one] = l [+] = m [+] = n [+] = o [+] = p [+] = q [+] = R [18] + s [+]-t [+] = u [x] = v [x] = w [+] + × [+] = y [ +] = z)*/