I just use this simple function to wrap the call to print_r. This displays your array in a good debugging format:
<?function html_print_r($arr) { ?><pre><? print_r($arr); ?></pre><?}?>