a::show PHP Method

show() static public method

Shows an entire array or object in a human readable way This is perfect for debugging
static public show ( array $array, boolean $echo = true ) : mixed
$array array The source array
$echo boolean By default the result will be echoed instantly. You can switch that off here.
return mixed If echo is false, this will return the generated array output.
    static function show($array, $echo = true)
    {
        $output = '<pre>';
        $output .= htmlspecialchars(print_r($array, true));
        $output .= '</pre>';
        if ($echo == true) {
            echo $output;
        }
        return $output;
    }

Usage Example

Example #1
0
    function testArrayShow()
    {
        $this->assertEqual(a::show($this->arr, false), '<pre>Array
(
    [cat] =&gt; miao
    [dog] =&gt; wuff
    [bird] =&gt; tweet
)
</pre>');
    }
All Usage Examples Of a::show