Debugger Function:
Wrote this for a small CMS to return a nicel formatted error string.
Accepts either a string or Array as the argument and cn debug superglobals as well
(POST, SESSION, GET, COOKIE et al)
function debugger($desc=null, $what) {
/* if it’s an array, print_r for formatted output
** */
if($desc) {
echo ‘<b>’. $desc .‘</b><br />’;
}
if(is_array($what)) {
/* give the formatting
** */
echo ‘<pre>’;
print_r($what);
echo ‘</pre>’;
} else {
/* otherwise just print out the string
** */
echo $what;
}
}
/* if it’s an array, print_r for formatted output
** */
if($desc) {
echo ‘<b>’. $desc .‘</b><br />’;
}
if(is_array($what)) {
/* give the formatting
** */
echo ‘<pre>’;
print_r($what);
echo ‘</pre>’;
} else {
/* otherwise just print out the string
** */
echo $what;
}
}