Thursday, March 19, 2009

Debugging technique: capture and email your ouput

Debugging technique: capture and email your ouput
Submitted by Eric on Wed, 08/13/2008 - 08:38
Tags:debug email Mail ob_end_clean ob_get_contents ob_start
Here's a quick debugging technique to capture your output and email it to yourself. This can be useful when you cannot send your debug output to the browser.


<?php
// start output buffer
ob_start();

// display the contents of your variable
print_r($YOURVARIABLE);

// get the contents of the output buffer
$ob = ob_get_contents();

// stop output buffer
ob_end_clean();

// mail contents of output buffer to yourself
mail('YOUREMAIL','Output Buffer Contents',$ob);
?>

1 comment:

Unknown said...

I think that you may be interested in another application that quickly eliminates data corruption issues in database files, please take a look at download recovery sql file freeware tool and let me know what do you think