Is there a pretty print for PHP?

Aaron Lee picture Aaron Lee · Jul 22, 2009 · Viewed 238.5k times · Source

I'm fixing some PHP scripts and I'm missing ruby's pretty printer. i.e.

require 'pp'
arr = {:one => 1}
pp arr

will output {:one => 1}. This even works with fairly complex objects and makes digging into an unknown script much easier. Is there some way to duplicate this functionality in PHP?

Answer

Joel Hernandez picture Joel Hernandez · Mar 8, 2012

This is what I use to print my arrays:

<pre>
    <?php
        print_r($your_array);
    ?>
</pre>

The magic comes with the pre tag.