I want PHP to output some text, then sleep for a second and a half, and then output some more text.
I think it is more a http request/response issue. On the command line your script works fine.
Normally the response is prepared completely and send to the client. If your response has such a size that multiple tcp packages have to be send, it could happen that the first packages are send, before you script is ready with processing. So it depends on the size of the output. Depending on the client/web browser, it could also happen that the first packages get rendered, before the complete response arrives at the client.
As Noufal Ibrahim answered while im typing, I totally agree with him. Do it in a asynchrone manner.