What are some common methods for outputting PHP arrays in HTML format for better readability in a web browser?

When outputting PHP arrays in HTML format for better readability in a web browser, it is common to use the <pre> tag to preserve the formatting of the array. This tag allows the array to be displayed in a monospaced font with line breaks and indentation, making it easier to read.

&lt;?php
$array = array(&#039;foo&#039; =&gt; &#039;bar&#039;, &#039;baz&#039; =&gt; &#039;qux&#039;);

echo &#039;&lt;pre&gt;&#039;;
print_r($array);
echo &#039;&lt;/pre&gt;&#039;;
?&gt;