debugger function

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;
                }
        }

Leave a Comment

Please note: Comment moderation is enabled and may delay your comment. There is no need to resubmit your comment.