PHP ob_get_clean() Function

P
PHP ob_end_flush() Function
PHP ob_get_contents() Function

In this article, you will learn how to get the content of the output buffer which is currently placed a the top of the stack, and then delete the content. The ob_get_clean() function in PHP returns the contents of the output buffer and then deletes the contents from the buffer.

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

ob_get_clean();

examples of the OB_GET_CLEAN() function

Example 1. In this example, we store the contents of an output buffer in a variable.

<?php
ob_start();
echo "Hello World!";
$contents = ob_get_clean();
echo "The contents of the buffer are: ";
echo $contents;
?>
PHP ob_end_flush() Function
PHP ob_get_contents() Function

Add comment

Tutor Network

Share this

Learn PHP from A to Z