snipt

Ctrl+h for KB shortcuts
#41454

PHP

printArray - print out the array structure in screen

1
2
3
4
5
6
function printArray($a,$return=true)    {
	if(!$return)
    echo "<pre style=\"font-size:12px;\">".print_r($a,true)."</pre>";
    else
    return "<pre style=\"font-size:12px;\">".print_r($a,true)."</pre>";
}
https://snipt.net/embed/e47ca9dcd3a11674ad37a37275ff2884/
https://snipt.net/raw/e47ca9dcd3a11674ad37a37275ff2884/
e47ca9dcd3a11674ad37a37275ff2884
php
PHP
6
2014-04-15T04:50:40
True
False
/api/public/snipt/41454/
printarray-print-out-the-array-structure-in-screen
<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 id="L-1"><a name="L-1"></a><span class="x">function printArray($a,$return=true) {</span> </span><span id="L-2"><a name="L-2"></a><span class="x"> if(!$return)</span> </span><span id="L-3"><a name="L-3"></a><span class="x"> echo &quot;&lt;pre style=\&quot;font-size:12px;\&quot;&gt;&quot;.print_r($a,true).&quot;&lt;/pre&gt;&quot;;</span> </span><span id="L-4"><a name="L-4"></a><span class="x"> else</span> </span><span id="L-5"><a name="L-5"></a><span class="x"> return &quot;&lt;pre style=\&quot;font-size:12px;\&quot;&gt;&quot;.print_r($a,true).&quot;&lt;/pre&gt;&quot;;</span> </span><span id="L-6"><a name="L-6"></a><span class="x">}</span> </span></pre></div> </td></tr></table>
debug, php, printArray, print_r
#2005

Text only

TextMate Bundle for PHP that I call Suitcase activated with 'sc'+tab for easily echoing array type variables in a browser readable output.

1
2
3
${1:echo} "${2:name_of_array} = <br /><pre>";
${1:echo} print_r(\$${2});
${1:echo} "</pre>";$0
https://snipt.net/embed/b87be31afd84d7555301d166de362aaa/
https://snipt.net/raw/b87be31afd84d7555301d166de362aaa/
b87be31afd84d7555301d166de362aaa
text
Text only
3
2014-04-15T05:43:52
True
False
/api/public/snipt/2005/
textmate-bundle-for-php-that-i-call-suitcase-activated-with-sctab-for-easily-echoing-array-type-variables-in-a-browser-readable-output
<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></pre></div></td><td class="code"><div class="highlight"><pre><span id="L-1"><a name="L-1"></a>${1:echo} &quot;${2:name_of_array} = &lt;br /&gt;&lt;pre&gt;&quot;; </span><span id="L-2"><a name="L-2"></a>${1:echo} print_r(\$${2}); </span><span id="L-3"><a name="L-3"></a>${1:echo} &quot;&lt;/pre&gt;&quot;;$0 </span></pre></div> </td></tr></table>
array, bundle, debugging, echo, output, php, print, print_r, textmate