I'm iterating over a huge array and it involves querying multiple APIs so to avoid data loss and timeout, I'm doing this:
for ($i = 0; $i < $count; $i++) {
if ($i % 100 == 0) {
echo 'processed: '.$i."
";
// save to file
}
}
... it works if the loop is a few hundred iterations during test and outputs processed ...
, but nothing at all in prod environment during the script is running, it echos everything only after its done. I just want to avoid any timeouts incase it takes (and usually does) long.