snipt

Ctrl+h for KB shortcuts

PHP

Prints out print_r in a readable format

1
2
3
4
5
6
// PRINTS OUT PRINT_R REALLY PRETTY
function print_r_html ($arr) {
        ?><pre><?
        print_r($arr);
        ?></pre><?
}
https://snipt.net/embed/99a15bb788a27cb61f7fc75da5a40e5b/
/raw/99a15bb788a27cb61f7fc75da5a40e5b/
99a15bb788a27cb61f7fc75da5a40e5b
php
PHP
7
2019-08-24T01:25:58
True
False
False
/api/public/snipt/17578/
prints-out-print_r-in-a-readable-format
<table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><a href="#L-1">1</a> <a href="#L-2">2</a> <a href="#L-3">3</a> <a href="#L-4">4</a> <a href="#L-5">5</a> <a href="#L-6">6</a></pre></div></td><td class="code"><div class="highlight"><pre><span></span><span id="L-1"><a name="L-1"></a><span class="x">// PRINTS OUT PRINT_R REALLY PRETTY</span> </span><span id="L-2"><a name="L-2"></a><span class="x">function print_r_html ($arr) {</span> </span><span id="L-3"><a name="L-3"></a><span class="x"> ?&gt;&lt;pre&gt;</span><span class="cp">&lt;?</span> </span><span id="L-4"><a name="L-4"></a> <span class="nb">print_r</span><span class="p">(</span><span class="nv">$arr</span><span class="p">);</span> </span><span id="L-5"><a name="L-5"></a> <span class="cp">?&gt;</span><span class="x">&lt;/pre&gt;</span><span class="cp">&lt;?</span> </span><span id="L-6"><a name="L-6"></a><span class="p">}</span> </span></pre></div> </td></tr></table>
function, php