开发者

PHP - How to start my count from 5000 [closed]

This question is unlikely to help any future visitors; it is only relevant to a small geographi开发者_如何学JAVAc area, a specific moment in time, or an extraordinarily narrow situation that is not generally applicable to the worldwide audience of the internet. For help making this question more broadly applicable, visit the help center. Closed 10 years ago.

How can i start the count from 5000 and count from there in my following code.

here is my code.

$i=1;
while($i<=19000){
    $i++;
}


You could initialize $i to the right value, before beginning looping :

$i=5000;
while($i<=19000){
    $i++;
}


And/or you could rewrite your code to use a for loop :

for ($i=5000 ; $i<=19000 ; $i++) {
    // use $i
}

In this kind of situations, using a for loop, instead of while, might make your code easier to understand.


Is that real question? Try:

$i = 5000;
while($i <= 19000){
    $i++;
}


Learning basics of programming seems needed: Have a look at the Introduction to Programming ... Go through the exercises there.

If you are interested in learning how to program using PHP have a look at Introduction to programming using PHP


simply initialise $i with 5000

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜