Output the given variables with formatting and location.

<?php

if (!function_exists('dump')) {
    /**
     * Output the given variables with formatting and location.
     *
     * Huge props out to Phil Sturgeon for this one
     * (http://philsturgeon.co.uk/blog/2010/09/power-dump-php-applications).
     *
     * To use, pass in any number of variables as arguments.
     */
    function dump()
    {
        list($callee) = debug_backtrace();
        $arguments = func_get_args();
        $totalArguments = count($arguments);
        echo "<fieldset class='dump'>".PHP_EOL.
            "<legend>{$callee['file']} @ line: {$callee['line']}</legend>".PHP_EOL.
            '<pre>';
        $i = 0;
        foreach ($arguments as $argument) {
            echo '<br /><strong>Debug #'.(++$i)." of {$totalArguments}</strong>: ";
            if (!empty($argument) && (is_array($argument) || is_object($argument))) {
                print_r($argument);
            } else {
                var_dump($argument);
            }
        }
        echo '</pre>'.PHP_EOL.
            '</fieldset>'.PHP_EOL;
    }
}