PHP while 循环加2

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/10745113/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-24 22:55:54  来源:igfitidea点击:

PHP while loop add by 2

phploopsscripting

提问by S17514

Currently I have a code that looks like:

目前我有一个看起来像的代码:

for ($i=0; $i<=($num_newlines - 1); $i++) 
{
$tweetcpitems->post('statuses/update', 
                    array('status' => wordFilter("The item $parts[$i]  has been released on Club Penguin. View it here:   http://clubpenguincheatsnow.com/tools/swfviewer/items.swf?id=$parts[$id]")));
sleep(90);
}

What I want to do make the "i++" part add by two and not one, but how do I do this? Please help!

我想做的是让“i++”部分加两个而不是一个,但是我该怎么做?请帮忙!

回答by John Conde

for ($i=0; $i<=($num_newlines - 1); $i+=2) {

回答by just eric

$i++ : increment by one

$i+=2 : increment by two

$i+=3 : increment by three

etc..

等等..