[Solved] How to use foreach/while to loop only through each 10000000? [closed]


Depends what language you are using. For example in PHP you could do this.

<?php

$stride = 10000000;
$num_iterations = 10;

for ($i = 0; $i < $num_iterations * $stride; $i += $stride) {
  // Do stuff with $i
}

However, as usual when programming, things can be done different ways. Often a different way leads to simpler code. For example, you might be able to get away with this:

<?php

$stride = 10000000;

for ($i = 0; $i < 10; $i++) {
  $num = $i * $stride;
  // Do stuff with $num
}

solved How to use foreach/while to loop only through each 10000000? [closed]