In the PHP learning array "1" to learn how to create an array, if PHP learning in the array "1" elements in more words, we access the element is a problem, the following we use the For statement While,foreach to traverse our array:
<?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);//creates an array of numbers//print_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 [n] = m [+] [[+] ~ ~ [] = [+] = [+] = [+] + q [+] => ; r [+] = s [+] = [x] = u [+] = v [+] + w [+] + × [] = y [ +] = z)*/$test=Array(1,2,3,4,5,6,7,8,9,0,10);//For ($i = 0; $i < count ($test), $i + +) {//Echo $test [$i]. ' <br/> ';/}/*Results * 123456789010*///While (!! $a =each ($test)) {//Echo $a [' value ']. ' <br/> ';/}/*result 123456789010*///foreach ($test as $value) {//echo $value. ' <br/> '; // }/*result 123456789010*/