简体   繁体   English

php-如何将变量增加100

[英]php - How to increase variable by 100

I am querying a URL (via php command line) that returns 100 values at a time only. 我正在查询仅一次返回100个值的URL(通过php命令行)。 So instead of me doing the increment (by 100) manually, how would I go about increasing it automatically? 因此,代替我手动进行增量(100),我将如何自动进行增量?

The URL for example is: example.com/getdata.php?start=0&return=100 例如,URL为: example.com/getdata.php?start=0&return=100 =0& example.com/getdata.php?start=0&return=100

for ( $start = 0; $start < 300001; $start++ )
{
    print ( "$start value is ".$start ) ;
    $start = $start+100;
}

you can put increment into for loop 您可以将增量放入for循环

for ( $start = 0; $start < 300001; $start=$start + 100 )
{
    print ( "$start value is ".$start ) ;

}

your current code is increasing loop counter by once as you are using $start++ in your for loop If you replace it with $start+=100, then it will increase counter by 100. such as 当您在for循环中使用$ start ++时,当前代码将循环计数器增加一次。如果将其替换为$ start + = 100,则它将使计数器增加100。

for ( $start = 0; $start < 300001; $start+=100 )
{
    print ( "start value is ".$start ) ;

}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM