實例:
<?php
? ? for($x=0;$x<5;$x++){
? ? echo 'The number is '.$x;
? ? echo '<br>';
}
?>
輸出結果為:
The number is 0
The number is 1
The number is 2
The number is 3
The number is 4
一共執行了五次,下面進行詳解
------------------------------------------------------
For語句執行順序
for(變量賦值①;判斷代碼②;變量運算④){
? ? 重復執行代碼③;
}
PS:推薦一首歌:《皇后大道東》——羅大佑&蔣志光