-1

I am querying a URL (via php command line) that returns 100 values at a time only. So instead of me doing the increment (by 100) manually, how would I go about increasing it automatically?

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

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

2 Answers 2

3

you can put increment into for loop

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

}
Sign up to request clarification or add additional context in comments.

1 Comment

If you want you can replace 100 with $return
2

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 = 0; $start < 300001; $start+=100 )
{
    print ( "start value is ".$start ) ;

}

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.