faqts : Computers : Programming : Languages : PHP : Common Problems : Tips and Tricks

+ Search
Add Entry AlertManage Folder Edit Entry Add page to http://del.icio.us/
Did You Find This Entry Useful?

5 of 10 people (50%) answered Yes
Recently 2 of 6 people (33%) answered Yes

Entry

Can I stop a page being displayed until the whole script has been parsed?

Jul 2nd, 1999 01:22
Nathan Wallace,


Not easily.  PHP4 will have support for output buffering.

In the meantime, you can accumulate your data in an array, and then
output the array conditionally. Replace your "echo" or "print" commands
with:

 $line[] = 

and then when you figure out you need to redirect, just redirect; else
loop over $line and echo every row.

It's a low-tech solution, but it works.