Foreach vs while for progressbar

I guess you’ve missed reading this

Please post the code you have that is exhibiting the behavior you are describing.