PHP4 has a cool built-in feature called output buffering - "output buffering is a powerful feature that lets developers create advanced and efficient programs very easily. PHP does not send the HTTP header as soon as the script emits output. Instead, it pipes this output into a dynamically growing buffer." This will allow you to make changes, such as adding a cookie or changing the headers before it's even sent to the browser (no more "Headers already sent" messages!) Check out this link for more information on this cool little feature.




