flush() basically tries to get the server's attention, saying, "Mr. Server, would you please take all the output my script has generated so far and send it out to the user's browser, even though my script has not yet finished running? Oh, but don't go away -- I may have some more stuff for you to send in a few seconds."
Now, depending on what web server is running on your host and how it's configured, it might respond in a couple ways, such as, "Sure thing Ms. PHP, I'm sending all the output you've given me so far to the browser right away." Or it might say, "Hey, I'll do all the flushin' around here, Baba Looey! Just send me your output, and I'll decide when it gets sent to the user."