1<?php
2/**
3 * Daniel Dias Rodrigues (aka Nerun) <danieldiasr@gmail.com>
4 * add to script:
5 * require_once('debug.php');
6 */
7function printr($var, $name=null) {
8    echo '<pre>';
9    if (!empty($name)){
10        echo $name.' =<br />';
11    }
12    if (is_array($var)) {
13        foreach ( $var as $key => $value ){
14            if ( is_array($var[$key]) ) {
15                print_r(array_map("htmlspecialchars", $value));
16            } else {
17                print_r(htmlspecialchars($value));
18            }
19        }
20    } else {
21        print_r(htmlspecialchars($var));
22    }
23    echo '</pre><br />';
24}
25