This function will turn output buffering on. While output buffering is active no output is sent from the script (other than headers), instead the output is stored in an internal buffer.
The contents of this internal buffer may be copied into a string variable using ob_get_contents(). To output what is stored in the internal buffer, use ob_end_flush(). Alternatively, ob_end_clean() will silently discard the buffer contents.
<?php function callback($buffer) { return (str_replace("PHP", "PHP Codez", $buffer)); } ob_start("callback"); ?> <p>Welcome to PHP</p> <?php ob_end_flush(); ?>
The output will be Welcome to PHP Codez