output-buffer

PHP: Suppress output within a function?

What is the simplest way to suppress any output a function might produce? Say I have this: function testFunc() { echo 'Testing'; return true; } And I want to call testFunc() and get its return value without "Testing" showing up in the page. Assuming this would be in the context of other code that does output other things, is t...

Output buffer

I am writing a php script and somewhere before my header() function i have printed text to the browser hereby causing my header() function give me a well known error: Warning: Cannot modify header information - headers already sent. Now my question is, I have the intentions of using ob_start() and ob_flush() before and after the he...

PHP usleep/sleep inside output buffer

Hello, I have a PHP application containing these files: landing.php, redirect.php, ajax.php on a page call to landing.php, I execute a javascript code to capture certain data, and issue an AJAX POST to ajax.php which inserts them into DB. Finally php header() redirects to redirect.php Currently the above feature is using output buf...