PHP ob_get_clean() Function Last Updated : 18 Aug, 2023 Comments Improve Suggest changes Like Article 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. PHP <?php // Create an output buffer ob_start(); echo "Welcome to GeeksforGeeks"; $out = ob_get_clean(); $out = strtolower($out); var_dump($out); ?> Output: string(24) "Welcome to GeeksforGeeks" Example 2: PHP <?php // Declare a class class GFG { public function GFG_Funcion() { $variable = array( "A" => "Welcome", "B" => "GeeksforGeeks", "C" => "Geeks" ); foreach ($variable as $key => $value) { echo $key . " => " . $value; echo "<br/>"; } } } ob_start(); // Creating an object of class GFG $object = new GFG(); // Calling function $object -> GFG_Funcion(); $saved_ob_level = ob_get_level(); $start_ob_level=""; while (ob_get_level() > $start_ob_level) { ob_end_flush(); } // Now, it is the final output buffer $content = ob_get_clean(); ?> Output: A => Welcome B => GeeksforGeeks C => Geeks Reference: https://www.php.net/manual/en/function.ob-get-clean.php Comment More infoAdvertise with us Next Article PHP ob_get_clean() Function coder36 Follow Improve Article Tags : Web Technologies PHP PHP-function Similar Reads PHP ob_get_contents() Function The ob_get_contents() is an inbuilt function in PHP that is used to capture what is currently being buffered by the output buffer. This function returns the output buffer. Syntaxob_get_contents(): string | falseParameter This function does not accept any parameters. Return Value The ob_get_contents( 2 min read PHP func_get_arg() Function The func_get_arg() function is an inbuilt function in PHP which is used to get a mentioned value from the argument passed as the parameters. Syntax: mixed func_get_arg( int $arg ) Parameters: This function accepts a single parameter as mentioned above and described below. $arg: This parameter holds 2 min read PHP | Imagick clear() Function The Imagick::clear() function is an inbuilt function in PHP which is used to clear all resource allocated to an Imagick object. Syntax: bool Imagick::clear( void ) Parameters: This function does not accept any parameter. It just clears off the resources of the Imagick object which is used to call th 2 min read PHP | Gmagick clear() Function The Gmagick::clear() function is an inbuilt function in PHP which is used to clear all resources associated to Gmagick object. Syntax: Gmagick Gmagick::clear( void ) Â Parameters: This function does not accepts any parameter. Return Value: This function returns the cleared Gmagick object. Errors/Exc 2 min read PHP ob_get_status() Function The ob_get_status() is an inbuilt function in PHP that is used for retrieving the status of the output buffer. Syntaxob_get_status(bool $full_status = false) : arrayParameter This function accepts only one parameter which is described below. $full_status: This is an optional parameter. If this param 2 min read PHP fclose() Function The fclose() function in PHP closes a file that was previously opened by fopen(). Closing a file releases the resource associated with it and makes sure all the data written to the file is properly saved. Not closing files can lead to resource leaks or incomplete data writing.Syntax:bool fclose(reso 2 min read PHP file_get_contents() Function In this article, we will see how to read the entire file into a string using the file_get_contents() function, along with understanding their implementation through the example.The file_get_contents() function in PHP is an inbuilt function that is used to read a file into a string. The function uses 3 min read PHP is_file( ) Function The is_file() function in PHP is an inbuilt function which is used to check whether the specified file is a regular file or not. The name of the file is sent as a parameter to the is_file() function and it returns True if the file is a regular file else it returns False. Syntax: bool is_file($file) 2 min read PHP eval() Function PHP eval() function in PHP is an inbuilt function that evaluates a string as PHP code. Syntax: eval( $string ) Parameters: This function accepts a single parameter as shown in the above syntax and described below. $string: It must consist of a valid PHP code to be evaluated but should not contain op 2 min read PHP token_get_all() Function The token_get_all() function is an inbuilt function in PHP that is used to tokenize a given PHP source code string into an array of tokens. This function is particularly useful for analyzing, parsing, or manipulating PHP code programmatically. Syntax: token_get_all(string $code, int $flags = 0)Param 2 min read Like