I am using a foreach statement that loops around 1000 and more times. I was wondering if there is a way to echo the results like every 50 loops until it reach the 1000 and stop.
The purpose of it is because I am writing a crawler, I want to see some results occasionally of what the script found instead of wait for many time for the whole thing.
Thank you
DhruvPathak’s solution kind of works, but the correct answer would be something like
In this solution, the echo is done AFTER each 50 (rather than doing it after the first item and then after each 50 items), and a final echo is done at the end if needed.