kub. How to pass a callback function with parameters for ob_start in PHP? 4. PHP 8. It is based on FPDF and HTML2FPDF, with a number of. Learn more about CollectivesI have an issue with a shortcode that I'm writing for wordpress. Sorry to resurrect a 4 year old post, but I stumbled across it and wanted to point out that ob_get_contents() followed by ob_clean() is not exactly the same as ob_get_clean(). The code is sorta lik. answered Mar 10, 2022 at 19:41. 2,268 1 1 gold badge 4 4 silver badges 7 7 bronze badges. For example, if the page you want to render to PDF can be accessed via a web server then you can just load that page in your Dompdf script:ob_get_clean (PHP 4 >= 4. Hope that is alright. 1. The ob_start() code worked perfectly. ob_get_flush flushes the output buffer, return it as a string and turns off output buffering. For what you are trying to do, there is no need to use ob_start and ob_flush. However, like I mentioned, if the webserver is. Description ¶. yes you need to take Response::make out of image2 function and put ob_end_clean() after imagejpeg. 0. 1. There is some things I dont get about end_clean, clean, get_clean, etc, and therefore, the answer is going to be different and nuanced from the other one. Esta función no destruye el búfer de salida como lo hace ob_end_clean () . If I vardump() the result of the Artisan::call method it just. 3. If ob_flush() isn't called at the end of the app, the contents are automatically flushed, again. So the first thing in your script should be ob_start (). Remember you need to clean the output buffer (ob_end_clean();) before the end of the file, or the page content could be outputted twice. Whether the buffer-cleaning functions _should_ invoke the output callback (keeping in mind that in themselves they do not generate. it will work as you would use ob_start with no. don't close the connection). See the syntax, return value, and examples of this function in PHP. Syntax. You would call this function last in the output buffering process because if you need to get or send the content stored in the output buffer, calling ob_clean() would clean the contents of the output buffer and there won't be any content to receive or send. 0. Definition and Usage. Obtiene el contenido del búfer actual y elimina el búfer de salida actual. Gets the current buffer contents and delete current output buffer. – Raj. Hey, no it didn't work Salut, je suis encore en apprentissage de la programmation web notamment avec PHP ou je suis encore novice . We get it wordpress has a function set up to pull in the content without using a buffer. Learn how to use the ob_get_clean () function to get the contents of an output buffer and delete it from the buffer. That will return the content rather than echo it directly and that you have to do in the case of a WordPress shortcode. W3Schools offers free online tutorials, references and exercises in all the major languages of the web. Syntax. Using output buffering ( ob_start () / ob_get_contents ()) is a valid way of addressing the problem however you need to move the code. txt which is the last line of that file. Hot Network Questions PostGIS fields of type interval not part of QGIS' field list Notepad++ writes a lot to disk after closing Why do many template languages have `for-else` statements?. Its output is rendered to the buffer. 语法:. ob_clean (): bool. If you only want to get data as string and clear buffer use ob_get_clean() You can think of output buffering as creating "bookmarks" or "restore points" in output buffer. To review, open the file in an editor that reveals hidden Unicode characters. But I was able to manage with just these two. 2. As a result, the first ob_start () will have an ob_get_level () of 2, the second will be 3, and so on. ob_get_clean, only works twice. 3. The output buffer must be. x. I have tried ob_flush(); and flush() but that doesn't help either. The function will be called when the output buffer is flushed (sent) or cleaned (with ob_flush (), ob_clean () or similar function) or when the output buffer is flushed to. It shows in the top all the time but I have read some about ob_start(); and trying to use it but the shortcode just returns nothing. GWW GWW. We hope this article has been informative and useful in understanding the ob_clean () function in PHP. joson_encode however does just fine, when wp_debug is disabled. Cách dùng ob start , ob flush (), flush () Trong PHP vốn đã chạy nhanh nay còn có thêm cơ chế cache làm cho ngôn ngữ PHP ngày càng hoàn hảo. 78k 3 3 gold badges 119 119 silver badges 161 161 bronze badges. e. ob_get_contents — Return the contents of the output buffer. Lets say this is my script:Wordpress take your content and apply filters to it. I found out that the problem can be fixed by either using return instead of echo, or by using output buffering: (ob_start () / ob_get_contents ()) Unfortunately my coding skills are not what I would like them to be. Stack Overflow is leveraging AI to summarize the most relevant questions and answers from the community, with the option to ask follow-up questions in a conversational format. And by that you can put the variable content into your json data. One way of outputting a webpage to mPDF without re-writing your scripts too much, is to buffer the output: MpdfMpdf () - Initialise an instance of mPDF class, and specify configuration. However, it is possible that you have output buffering enabled for all files through the output_buffering ini parameter (see the manual ). Hi, i am using 0. Enough already with the “get_the_content()” jabber. – r3wt. When the. The call to ob_get_clean will return the contents of your buffered output. By understanding the syntax and usage of the function, you can easily start output buffering and modify your output before sending it to the client. Learn more about TeamsIt is that the ob_start, ob_get_clean don't work synchronously in the view process causes the problem. e. So ob_start() is supposed to capture output until another buffer function is called like ob_get_clean(), ob_get_contents(), ob_get_flush(). ob_get_flush ( ): string|false. ob_get_clean — Get current buffer contents and delete current output buffer. Example shortcodes:I found ob_start() and ob_get_clean() in php manual to achieve this. $image_data = ob_get_contents(); ob_end_clean(); echo $image_data; unlink($nameimage); Client (192. flush (); // Display the rest of the content three seconds later. Show file. ob_get_clean returns a string of whatever has entered the output buffer since your ob_start () call and then deletes the contents from the buffer (in this particular example you never set the output of this function to anything, so your code should do nothing). 0, but it seems that the function is deprecated in 4. Get early access and see previews of new features. Follow answered Mar 1, 2011 at 23:25. What I am trying to do to get rid of buffer contents is using ob_end_clean() to empty the buffer completely. flush is different in that it asks the web server to output PHP's current internal buffer to the client (browser), but to wait for further output (i. See parameters, return values, examples and user notes. If you just want to clean the buffer after starting output buffering with. Covering popular subjects like HTML, CSS, JavaScript, Python, SQL, Java, and many, many more. If you want to further process the buffer's contents you have to call ob_get_contents () before ob_end_flush () as the buffer contents are discarded after ob_end_flush () is called. djjjozsi, thank you for your attempt but your code just echoed the ranking. If you look at the source for these. Whether the buffer-cleaning functions _should_ invoke the output callback (keeping in mind that in themselves they do not generate. If you are using error_log(), use ob_get_contents() and ob_end_clean() instead of ob_get_clean(). And for that, you can give him the content like the previous example, or give an url. Well, you shouldn't even be able to do ob_clean(); before ob_start(). There are a number of functions related to output buffering, but the two we’ll use are ob_start and ob_get_clean. Share. The ob_clean () function deletes all of the contents of the topmost output buffer, preventing them from getting sent to the browser. Is it po. What is the ob_get_level() Function? The ob_get_level() function is a PHP built-in function that allows you to get the current level of output buffering. . It should really only give you the 1st one. I think I'll better send the output in an HTML file using the code you provided me. ob_get_clean, only works twice. ob_get_clean () essentially executes both ob_get_contents () and ob_end_clean () . 2. Improve this answer. This code adds wp_nav_menu_items wordpress hook. This function will turn output buffering on. It seems like MAMP is not performing the function 'ob_get_clean()' correctly. Descrição ¶. If you want to use it for a larger buffer you have to edit your php. // Turn on implicit flushing. Right now all the stuff that gets included in wp_head are left justified all the way in the code view. ob_end_clean () Deletes the topmost output buffer and all of its contents. 4 ob_* functions. 1 1 1 silver badge. I'd expect a notice that the buffer wasn't started with the proper PHP_OUTPUT_HANDLER_CLEANABLE flag as per the docs. I also tried v5. However, instead of repeatedly starting a new buffer, you could just erase the current buffer with ob_clean() in between calls of ob_get_contents()now what i want here is to remove the newlines from the stored output of the ob_get_clean(). Books. ob_get_clean() silently discards the buffer contents. Connect and share knowledge within a single location that is structured and easy to search. Thanks for contributing an answer to Stack Overflow! Please be sure to answer the question. No, this is not a correct use for ob_start(). Covering popular subjects like HTML, CSS, JavaScript, Python, SQL, Java, and many, many more. php: SFWD_CPT_Instance::template_content () Generate output for courses, lessons, topics, quizzes Filter callback for ‘the_content’ (wp core filter)In this article, we will take an in-depth look at the ob_get_level() function and its usage. ob_start () use. We hope this article has been informative and useful in understanding the ob_start () function in PHP. Definition and Usage. In versions of dompdf prior to 0. The output buffer must be started by ob_start () with PHP_OUTPUT_HANDLER_CLEANABLE and PHP_OUTPUT_HANDLER_REMOVABLE flags. The browser should then only get gz-encoded data as it was the output buffer at the topmost level. Community Bot. If you want to capture instead of echoing, you should use ob_get_clean () – kijin. php is just echoed. Output Control 함수 목록. I think what @toscho tried to say isn't that you can't nest, but that if for some reason you call ob_get_clean() before the code of e. ini has my output_buffering set to 4096. I am writing a plugin that requires a large chunk of html. Learn more about CollectivesWhen using PHP as the back-end for SSE (Server Sent Events) and similar server streaming solutions, I have been using the @ob_flush();@flush() idiom to make sure the data gets spat out immediately. Lo tienes al revés. There are a number of functions related to output buffering, but the two we’ll use are ob_start and ob_get_clean. Connect and share knowledge within a single location that is structured and easy to search. The output buffer, on the other hand, will catch all output that takes place after ob_start() including (HTML) output of any warnings or errors you might have in the code before you call ob_get_contents();. The string will be captured and echoed. When I opened the file in notepad, I could see it was just the raw html. ob_get_clean essentially executes both ob_get_contents and ob_end_clean (). 0, PHP 5, PHP 7) ob_get_clean — Get current buffer contents and delete current output buffer Description ob_get_clean ( ) : string Gets the current buffer contents and delete current output buffer. Description ¶. Capture php output of function call. ob_flush does not work on my server. There raises a question, if we use ob_end_clean() to clean the whole output buffer then why even use output buffering. Hi, we were using html_output() to get all the tags generated by the SEO Framework 4. Your shortcode callback is going to output content rather than return it which is why you're seeing it appear at the top of your page. Am on a shared server. Some parameters will be different depending on the include. ob_get_length — Return the length of the output buffer. ob_get_clean() essentially executes both ob_get_contents() and ob_end_clean(). Output can come from any of the following sources:. asked Nov 19, 2013 at 0:45. ob_get_clean — Get current buffer contents and delete current output buffer. ob_get_clean() combines my use of ob_get_contents() and ob_end_clean(). clean) can occur simultaneously. The central point of my comment is that it is not possible - based on that you appear to preclude output buffering in your original post. Of course, I was overlooking the fact that the only reason to use the callback on ob_start() was because I wanted to run Obfuscate() on the content before it was flushed, but if I'm getting that content back I don't need to run a callback! So, not using a callback and just running ob_get_clean()'s results through Obfuscate() does what I wanted. Viewed 2k times. header is not cleared after executing ob_get_clean. Taking ob_start() out of my code seems to make no difference to how it works. From PHP 5. May 23, 2015 at 9:20. Want to include php file in WP content. php output. Here are the functions you could use: ob_get_clean. For the OP's purposes, it's probably fine, but ob_get_clean() ends output buffering while ob_get_contents() and ob_clean() do not. 出力バッファを「フラッシュ(出力)」してから、出力のバッファリングをオフにする。. The output buffer contents are returned correctly but if I have a file containing 100 lines of text the output buffer returns empty string (string with value null). ob_flush() - Vaciar (enviar) el búfer de salida ob_end_flush() - Volcar (enviar) el búfer de salida y deshabilitar el almacenamiento en el mismo ob_end_clean() - Limpiar (eliminar) el búfer de salida y deshabilitar el almacenamiento en el mismo +add a note現在のバッファの中身を取得し、出力バッファを削除します。 ob_get_clean() は、基本的に ob_get_contents() および ob_end_clean() を同時に実行するのと同じです。 出力バッファを開始するときに、 ob_start() で PHP_OUTPUT_HANDLER_CLEANABLE フラグを指定する必要があります。I know that this is an old question but I wanted to write my answer for visual learners. This includes information about PHP compilation options and extensions, the PHP version, server information and environment (if compiled as a module), the PHP environment, OS version information, paths, master and local values of configuration options, HTTP headers, and. La función ob_get_clean() es la combinación de ob_get_contents() y ob_end_clean(). When the. ob_clean() This function removes what is stored in the output buffer. another plugin which started the first ob_start() calls ob_get_clean() you'll get unexpected results. I couldn't find any diagrams explaining output buffering on the worldwide-web so I made a diagram myself in Windows mspaint. If you are using error_log(), use ob_get_contents() and ob_end_clean() instead of ob_get_clean(). While this is convenient in some situations for generating documents on-the-fly it also exposes a. Parameters. Share. 5. Oct 30, 2010 at 20:39. log (ab_id_transakce); return empty variable because there is in php ob_get_clean (). I want to write 1 include shortcode. 'options' => apply_filters('tutor_monetization_options', array( //add new monetization options here 'free' => __('Disable Monetization', 'tutor'), )),. The output may be caught by another output buffer or, if there are no other output buffers, sent directly to the browser. htaccess. 5k 3 3 gold badges 48 48 silver badges 77 77 bronze badges. It can be distinguish using binary operator &:If you use ob_get_clean(), you delete output buffer after first call. php file and you should start seeing Login / Login on your main header. ob_get_flush() return the buffer and immediately output it. 22. If I remove the ob_end_clean(); the output is hi hi. Once again, using [my-info display=”email”] will return only the email section of the information but it will use a span tag with color red to wrap the content. Kakou347 opened this issue on Apr 27, 2019 · 1 comment. ob_get_clean — Get current buffer contents and delete current output buffer. Pippin. Le tampon de sortie doit avoir été démarré avec la fonction ob_start () et le drapeau PHP_OUTPUT_HANDLER_CLEANABLE . Output buffers are stackable, that is, you may call ob_start () while another ob_start () is active. Output Control 함수 목록. Tour Start here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies of this siteSorry flushblocks(); got left in there by accident, that shouldn't be in the example. See syntax, parameters, return value and examples of this function. Now the way how it is set up now works. For the OP's purposes, it's probably fine, but ob_get_clean() ends output buffering while ob_get_contents() and ob_clean() do not. x and PHP 5. The ob_get_contents () function has different return behaivor in PHP 5. ob_get_contents() fetches whatever is inside the buffer. We can take the previous example to learn how to subsequent buffers into a stack. Here is sample php code snippet for function call. I'm facing a weird problem when using the Elementor Wordpress Page Builder. I have known for a long time that it closes the buffer and calls both ob_get_contents and ob_end_clean. Two problems. Esta función desecha el contenido del búfer de salida. We then investigated ob_start to capture the output buffer. Oct 16, 2014 at 16:02. But before returning the code to the caller, do the necessary text substitution. Otherwise ob_clean() will. it will work as you would use ob_start with no. 得到当前缓冲区的内容并删除当前输出缓冲区。 ob_get_clean() 实质上是一起执行了 ob_get_contents() 和 ob_end_clean() 。 输出缓冲区必须由带有 PHP_OUTPUT_HANDLER_CLEANABLE 和 PHP_OUTPUT_HANDLER_REMOVABLE flag 的 ob_start() 启动。 否则 ob_get_clean() 将不起作用。Am using the code below to download a file. WordPress uses get_ for returning almost any function inside the loop without echoing out to the browser. You might try checking to see if the values are an object first, and then using the PHP function to convert to an array. , ob_get_clean() would only return the contents of style. Code Examples. 4. 참고 See also header() and setcookie() . htaccess. My main template file which would have the page layout (header, body, sidebar, footer) is included into the page. So, fortunatly there is some php tools that do interpret the page and can fetch any sub files. 3. Share. Description. 0. 2. 43. Using the ob_get_level() function is straightforward. ob_get_clean ( ): string|false. 2 with no alternative. PHP ob_end_clean does not clear buffer. Je n'ai pas trouvé de solution a mon problème j'ai remplacé comme vous me l'avez dis HOOK_HOME_SECONDARY_LEFT, et ce dans différents fichiers. We use ob_end_clean() with ob_get_contents() which first gets the contents as a string and then the output buffer is cleaned and turned off, this clears the global stack and keeps the whole content in a variable to be processed. So the browser doesn't receive header correctly. echo str_pad ("Hello World!", 4096); // Even though the script is still running, the. After this is done you are not able to modify header. Please don't revive it unless you have something important to add. Conclusion. Advantages of output buffering. The output buffer must be started by ob_start () with PHP_OUTPUT_HANDLER_CLEANABLE flag. (PHP 4 4. Yes it is possible. Take a look at very simple example for PHP 5. PHP may be configured to automatically create an output buffer when the script begins, which is why the buffer level may be 1 without calling ob_start (). First follow what the codex says Shortcodes. The output buffer must be started by ob_start () with PHP_OUTPUT_HANDLER_CLEANABLE flag. This one uses ob_get_clean() and does not produce the correct result:Wordpress: ob_get_clean(); doesn't return $value in shortcode?Helpful? Please support me on Patreon: thanks & prai. i dont know how you can get the gd2 resource into an object you can pass to Response::make. Add a comment | Your Answer Reminder: Answers generated by Artificial Intelligence tools are not allowed on Stack Overflow. Something like this:. If you want to further process the buffer's contents you have to call ob_get_contents () before ob_flush () as the buffer contents are discarded after ob_flush () is called. The W3Schools online code editor allows you to edit code and view the result in your browser1 Answer. The output buffer must be started by ob_start with PHP_OUTPUT_HANDLER_FLUSHABLE flag. ini. 0, PHP 5, PHP 7) ob_get_clean — Get current buffer contents and delete current output buffer Description ob_get_clean ( ) : string Gets the current. There are two ways that I can think of at this moment. Có nhiều lợi ích khi sử dụng ob_start trong PHP, bao gồm: Giảm tải server: ob_start có thể giúp giảm tải server bằng cách lưu trữ toàn bộ dữ liệu đầu ra trong bộ đệm (buffer) trước khi gửi nó đến trình duyệt. I am including HTML template in my shortcode by using ob_start & ob_get_clean. So there's possibly some other non-printable. The cool thing about ob_get_clean() is that it executes both ob_get_contents() and ob_end_clean(). Asking for help, clarification, or responding to other answers. Neither discarding the buffer's contents (ob_clean() ob_end_clean(), ob_get_clean()) nor retrieving the current buffer contents (ob_get_contents(), ob_get_clean()) invoke the output callback. Teams. So, the functions ob_start(); ob_get_contents(); and ob_end_clean(); don't work. 4. Share. Best you can do is:. The ob_end_flush () function deletes the topmost output buffer and outputs all of its contents. When output buffer is ended it is sent to the client (browser). 0. ob_clean () Also be aware that nothing is already being flushed with functions like echo, print_r, etc. It says that use of flush() and ob_flush() will cause the data to go in memory until it's displayed and as such that its not good for server with limited resources. In PHP 8. output_compression to 0 or Off; 3) setting Apache variables such as "no-gzip" either through apache_setenv () or through entries in . php Project: jiatower/php. php, ignoring any *. ob_clean () Also be aware that nothing is already being flushed with functions like echo, print_r, etc. 13 of php on MAMP and saw the same problem. Follow answered Feb 29, 2016 at 15:54. i was using ob_start but it is a banned function for me. If I run something like: while (ob_get_level () > 0) { ob_end_clean (); } Then I can successfully run ob_start () with the ob_gzhandler callback. After this you can move go on - even with only flush () instead of ob_flush (). Esto se utiliza comúnmente para que las páginas puedan enviar cabeceras "después" de haber "enviado" algún contenido (es decir. 1. ob_get_clean() When ob_end_clean() is called, it turns off buffering. ob_get_clean does two things: it gets the contents of the buffer as a string, and it cleans out the buffer. How to Use the ob_get_length() Function. In theory when I call _insert() function in test. The ob_clean () function deletes all of the contents of the topmost output buffer, preventing them from getting sent to the browser. php some other way. Thanks for contributing an answer to Stack Overflow! Please be sure to answer the question. I have used ob_start and ob_get_clean function to clear the buffer and it starts working. Tôi có 1 ví dụ đơn giản như sau: New search experience powered by AI. That wasn't the central point of my comment. ob_get_clean, only works twice. - At the end of the ajax page callback, we would ob_get_clean() + watchdog, then headers + print, then ob_start() again, register a shutdown function, and exit(). g. ob_get_flush — Flush the output buffer, return it as a string and turn off output buffering. ob_get_length — Return the length of the output buffer. –As posts get their data set up via the_post() (respectively via setup_postdata()) and are therefore accessible through the API (get_the_ID() for e. // We use str_pad () to make the output long enough. Im novice so i dont understand what this doing. Enabling output buffering decreases the download time it takes and renders the HTML in the browser. No examples exist of running ob_get_clean within a while loop, and for my purpose there is no alternative. W3Schools offers free online tutorials, references and exercises in all the major languages of the web. It looks like the answer is no, there is no single command to get the output buffer and erase it without turning it off. But you have not end the OB then! – Richard. While output buffering is active no output is sent from the script (other than headers), instead the output is stored in an internal buffer. We can take the previous example to learn how to subsequent buffers into a stack. There are two other functions you typically pair it with: ob_get_contents (), which basically gives you whatever has been "saved" to the buffer since it was turned on. Connect and share knowledge within a single location that is structured and easy to search. exe. 在 ob_start () 之後的程式碼中的輸出語句都會進入輸出緩衝區. 在php的默认配置下,php输出是先输出到缓冲区(output_buffering,内存区域),然后输送到浏览器。. Q&A for work. I'm generating a ton of XML that is to be passed to an API as a post variable when a user click on a form button. คำอธิบายที่ดี ฉันจะไปอีกขั้นหนึ่งแล้วแทนที่ob_get_contents()ด้วยob_get_clean()และลบob_end_clean()เนื่องจากจะob_get_clean()ทำหน้าที่ทั้งสองอย่างเป็นหลัก การ. The function will be called when the output buffer is flushed (sent) or cleaned (with ob_flush(), ob_clean() or similar function) or when the output buffer is flushed to the browser at the. . Documentation for ob_get_clean() Share. For example: use function OutputControl\ob_start; use function OutputControl\ob_end_flush; use function OutputControl\ob_get_clean; ob_start (); echo "Hello, world. If your theme is not displaying your shortcodes, probabily you output the content of the post without let Wordpress filter it. Stacking Output Buffers. It executes both ob_get_contents () and ob_end_clean () functions. Using ob_start() and ob_get_clean() allows you to return HTML code from the shortcode. typo, undefined variable, etc. Calling the function get_the_content () for a post, does not run the filter for shortcodes (if any). cls. 0. Try using output buffer like this : ob_start (); // your includes echo ob_get_clean (); Use this in all of your includes, and you will not get any errors. The ob_get_level () function indicates how many output buffers are currently on the stack. 1 Answer Sorted by: 9 This will return the same as your example given : ob_start (); echo 'custom code'; echo 'another line of custom code'; echo 'more code'; return. 現在のバッファの中身を取得し、出力バッファを削除します。 ob_get_clean() は、基本的に ob_get_contents() および ob_end_clean() を同時に実行するのと同じです。 出力バッファを開始するときに、 ob_start() で PHP_OUTPUT_HANDLER_CLEANABLE および PHP_OUTPUT_HANDLER_REMOVABLE フラグを指定する必要があります。Gets the current buffer contents and delete current output buffer. ob_gzhandler() - Được sử dụng như một hàm gọi lại cho ob_start() để nén nội dung của bộ đệm khi gửi nó đến trình duyệt. ob_get_contents — Return the contents of the output buffer. If you just want to clean the buffer after starting output buffering with. Capture php output of function call. add_filter('wp_nav_menu_items', 'crunchify_add_login_logout_menu', 10, 2);2. Return Value: Returns a string containing the contents of the buffer: PHP. ob_srtart begins output buffering. The string includes specials tags like the following as well as normal text + images. If not it should be the output-handler you used, check your php. css files; whereas ob_get_flush() returns the contents of both file types. Follow edited Mar 10, 2022 at 21:43. Covering popular subjects like HTML, CSS, JavaScript, Python, SQL, Java, and many, many more. PHP_OUTPUT_HANDLER_CLEAN when calling ob_clean(), ob_end_clean() and ob_get_clean() PHP_OUTPUT_HANDLER_WRITE automaticflush; Phases start, final and flush (resp. If you make use of ob_start('ob_gzhandler') to let PHP deal with the compression and you then echo ob_get_clean(), you will create an unreliable output. 4. While returning from the function you have to use ob_start() and ob_get_clean() then alone you can get the result in the place where you need. This function does not destroy the output buffer like ob_end. g. The rocket booster and then the spacecraft.