i recently started employing output buffering on some of the sites i run and it's working out very well. one site is a commerce site that securely collects credit card numbers and sends all of the data off to Verisign for payment processing. basically what i'm doing is running ob_start() at the top of my index page and if the users chooses to pay by credit card then the form data is collected and i am using the header() function to send all the data off by appending to the url.
ob_start ();
...collect user data via form...
if ($payment_option == 'credit card')
{
...build $url from the form input data...
ob_end_clean ();
header ("location: $url");
exit ();
}
else
{
...tell user that they will receive a bill by mail...
}
ob_end_flush ();
my question is this: is it necessary to call ob_end_clean() right before the header() function and exit() right after? the script works either way but is it considered good housecleaning practice to blow out the buffer after it is no longer needed? are they any potential pitfalls doing it this way?
thanks