Sunday 8 September 2013

PHP: how to clear echo buffer

Sometimes we need to clear all previously output such as : echoed text, printed, buffer ....
"ob_get_clean()" is solution.

<?php
//ob_start(); // This function must be put at top of file. It will turn output buffering on, but not important because default is on
?>
Demo output !
<?php
echo "Hello World";
ob_get_clean();
?>

1 comment: