tags:

views:

79

answers:

3

I'm on a 3rd party software and when I output the data from the array using var_dump() or print_r(), it comes out messy.

Anyone know of a way to output the data in a hierarchical format or something more organized (or some script that does it for me)?

Thanks!

+5  A: 

If you mean messy, as in not formatted, you could use <pre> to get it to format it as it's printed.

Or write a function like so

function debug($debug) {

    if (is_array($debug)) {
         echo '<pre>' . print_r($debug, true) . '</pre>';
    } else {

         echo $debug;
    }


}
alex
A: 

Use print_a() from debuglib! http://phpdebuglib.de this is what you want :-)

You can throw in any array and it gets dispalyed in a nice table, also nested data.

You can put it inside the page or at the end.

A: 

Take a look at http://kaloyan.info/krumo/

Except the collapsible DHTML tree built around the structure of the dumped PHP variable, and the improved by the CSS looks, Krumo offers additional useful features.

...or install a "real" debugger like e.g. xdebug combined with netbeans with the php plugin.

VolkerK