note 102568 modified in function.ob-get-clean by danbrown

[email protected] Tue, 22 Feb 2011 03:38:09 -0800
Newsgroups php.notes
Message-ID <[email protected]>
Also, don't forget that you will need to ob_start() again for any successive calls:

<?php
ob_start();
echo "1";
$content = ob_get_clean();

ob_start(); // This is NECESSARY for the next ob_get_clean() to work as intended.
echo "2";
$content .= ob_get_clean();

echo $content;
?>

Output: 12

Without the second ob_start(), the output is 21 ...

--was--
Also, don't forget that you will need to ob_start() again for any successive calls:

ob_start();
echo "1";
$content = ob_get_clean();

ob_start(); // This is NECESSARY for the next ob_get_clean() to work as intended.
echo "2";
$content .= ob_get_clean();

echo $content;

Output: 12

Without the second ob_start(), the output is 21 ...

http://php.net/manual/en/function.ob-get-clean.php