PHP ob_clean() Function

P
PHP flush() Function
PHP ob_end_clean() Function

In this article, you will learn how to delete all the contents of the output buffer currently placed at the top of the stack. It does not send the contents to the browser before deleting them. The ob_clean() function in PHP deletes all of the contents of the topmost output buffer, preventing them from getting sent to the browser.

what is the syntax of the OB_CLEAN() function in php?

ob_clean();

examples of the OB_CLEAN() function

Example 1. In this example, we delete some output before it can get sent to the browser.

<?php
ob_start();
echo "This output will not be sent to the browser";
ob_clean();
echo "This output will be sent to the browser";
ob_end_flush();
?>
PHP flush() Function
PHP ob_end_clean() Function

Tutor Network

Share this

Learn PHP from A to Z