Open In App

PHP ob_get_clean() Function

Last Updated : 18 Aug, 2023
Comments
Improve
Suggest changes
1 Like
Like
Report

The ob_get_clean() function is an in-built PHP function that is used to clean or delete the current output buffer. It's also used to get the output buffering again after cleaning the buffer. The ob_get_clean() function is the combination of both ob_get_contents() and ob_end_clean().

Syntax:

string|false ob_get_clean();

Parameters: It does not accept any parameter.

Return value: This function returns the contents of the output buffer and end output buffering. If output buffering is not active, then it returns false.

Example 1: Below is a simple example of ob_get_clean() functionality.

Output:

string(24) "Welcome to GeeksforGeeks"

Example 2:

Output:

A => Welcome
B => GeeksforGeeks
C => Geeks

Reference: https://www.php.net/manual/en/function.ob-get-clean.php


Similar Reads