I add this function to the global scope on just about every project I do, it makes reading the output of print_r() in a browser infinitely easier.
<?php
function print_r2($val){
echo '<pre>';
print_r($val);
echo '</pre>';
}
?>
It also makes sense in some cases to add an if statement to only display the output in certain scenarios, such as:
if(debug==true)
if($_SERVER['REMOTE_ADDR'] == '127.0.0.1')