2021-06-26

For loop not waiting finish one item to start another item [closed]

This is my loop setup: for ($i = $current; $i < $maximum && $i < $total; $i++) {...}

I added some error_log() inside the loop to check if all items are following the right steps order: 1. starting 2. check if exist 3. create if not exist 4. finish.

But sometimes, the log is something like this:

  1. starting #2008
  2. check if exist
  3. starting #2008
  4. check if exist
  5. create if not exist
  6. create if not exist
  7. finish #2008
  8. finish #2008

That is: it's look like the loop is running twice for the same item and create a duplicated item.



from Recent Questions - Stack Overflow https://ift.tt/2Sqkffu
https://ift.tt/eA8V8J

No comments:

Post a Comment