ehmm, i had that same problem , or better to say i wanted to do the same thing you want to do.
I think our problem is the sleep funtion. I don't think php is able to do the stuff we want do to. I is able to wait a certain time (for i nstance 10 secs) and then do everything at once but i doubt whether it can to it the way you want it and have posted it in your post. (the for loop).
I definetly know it works with Java Script, but i don't knwo if that helped you.
But i would be glad if someone says the opposite and this way of coding is supported ...
regards ali