$numarr1 = range(1,4); //(1,2,3,4)
$numarr2 = range(1,10,2); //(1,3,5,7,9)
$letter = range(‘a‘,‘z‘); //(‘a‘,‘b‘,‘c‘......‘z‘)
$fruit[3] = (‘apple‘, ‘banana‘, ‘pear‘);
for ($i = 0;$i<3;$i++)
echo $fruit[$i].‘ ‘;
//等价于下面代码
foreach ($fruit as $current)
echo $current.‘ ‘;
$price = array(‘a‘ => 10, ‘b‘ => 20, ‘c‘ => 30);
//等价于下面的代码:
$price[‘a‘] = 10;
$price[‘b‘] = 10;
$price[‘b‘] = 10;
foreach ($price as $key => $value)
echo $key.‘ => ‘.$value.‘
;
while (list($product, $pri) = each($price))
echo "$product - $pri
";
6.explode()分割数组.
其他数组操作:each() , current() , reset() , end() , next() , pos() , prev().