Bookmark and Share

Sunday, February 14, 2010

When var_dump is not enough.


Using this library you can browse the content of complex variables, one nested level at the time by using commands such as zoomin, zoomout and exit. Currently, this class should only be used for command line applications. Web browsable functionality will be added later using through firephp/firebug.


By executing the snippet below you will see the following screen. At this point you can decide to exit (or zoomout), or zoom in to nested variable links [1] and [2].



class Test {

var $a='hi';
var $b = array(1, 2);


$complex = array(1, 'hi', array(99, 17), 'std' => new stdClass(), new Test(), array());




For command line application development this beats var_dump and will save you a ton of time when debugging.


RDumper API Doc

Future enhancements

Color coding?


  1. If var_dump isn't enough, maybe you need an IDE with a debugger...

  2. @Richard: Really funny.

    Unfortunately there are lots of people still stuck with the var_dump style of debugging. However, they try to evolve and beautify var_dumps.

  3. when debug in browser, I thing firephp is a better choice.

  4. @@ thanks guys, IDE+command line dumper + firephp = complete set of tools

    -- I am also looking to expand RawDev with other XDebug functionality such as profiling.

    Debug PHP code in an IDE in less than one hour. Using an IDE debugger in addition to RawDev's debugging tools will give you a comprehensive set of debugging tools.

    This quick tutorial is targeted to Mac OS X and Linux but should be clear enough for other platforms.