How can I print the array in a Tree-like format--making it easier to read?
Try:
<pre><?php print_r($var); ?></pre>
It will give the proper tree structure that HTML's whitespace policy trims out.
Are you wrapping the output in <pre>
tags? That should get you pretty decent output, because it will show the spaces. Another option would be to install the xdebug extension, which then can replace var_dump
so that it generates more-readable HTML output.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With