Page 1 of 1

ob_end_clean()

Posted: Thu Oct 16, 2003 12:37 pm
by Gen-ik
I think this does what it's ment to but could someone please confirm that this will in fact clear the buffer before the page is echo'd to the browser.

Code: Select all

ob_start();

function DoBuffer()
{
    $buffer = ob_get_contents();
    ob_end_clean();

    // Do some stuff with the buffer contents

    echo $buffer;
}

DoBuffer();
I know this could be done using ob_start("DoBuffer") but it's only an example... I'm using the buffer stuff within a class.

Posted: Thu Oct 16, 2003 2:40 pm
by evilMind
Test using something like:

Code: Select all

$foo = ob_get_contents();
if ( ob_end_clean() ) {
   echo ($fooAgain = ob_get_contents() ? 'Buffer Not clean' : ' Buffer is clean');
}
bool ob_end_clean ( void )