Is there a pretty print for PHP?
This is what I use to print my arrays:
<pre> <?php print_r($your_array); ?></pre>
The magic comes with the pre
tag.
Both print_r()
and var_dump()
will output visual representations of objects within PHP.
$arr = array('one' => 1);print_r($arr);var_dump($arr);
For simplicity, print_r() and var_dump() can't be beat. If you want something a little fancier or are dealing with large lists and/or deeply nested data, Krumo will make your life much easier - it provides you with a nicely formatted collapsing/expanding display.