亚洲国产日韩欧美一区二区三区,精品亚洲国产成人av在线,国产99视频精品免视看7,99国产精品久久久久久久成人热,欧美日韩亚洲国产综合乱

for和while很像,是計(jì)數(shù)循環(huán),do whlie是先執(zhí)行再判斷,foreach主要是針對(duì)于數(shù)組

原創(chuàng) 2019-03-22 19:52:00 254
摘要:<?php $min =1; $max =10; $a=range($min,$max); // var_dump($a); function accu($min,$max){ $data=range($min,$max);//創(chuàng)建了1-10的數(shù)組 $count=count($data); $b=0; for ($i=0; $i <$count ; $i++) { 

<?php

$min =1;

$max =10;

$a=range($min,$max);

// var_dump($a);

function accu($min,$max){

$data=range($min,$max);//創(chuàng)建了1-10的數(shù)組

$count=count($data);

$b=0;

for ($i=0; $i <$count ; $i++) { 

$b +=$data[$i];

}

return $b;

}

echo accu(1,200). '<br>' ;

$b=0;

while ( $b<= 10) {

echo 'hello word'.'<hr>' ;

$b++;


}

foreach ($a as $k => $v) {

echo $k .'=>' .$v.'<br>';

}


?>


批改老師:天蓬老師批改時(shí)間:2019-03-23 08:47:43
老師總結(jié):實(shí)際上, 這些循環(huán)之間, 是可以相互轉(zhuǎn)換的, 可以動(dòng)手試試看

發(fā)布手記

熱門詞條