snipt

Ctrl+h for KB shortcuts

PHP

Using $_GET[] to get id

1
2
3
4
5
6
7
<?php 

$id = $_GET['id'];

echo $id; 

?> 
https://snipt.net/embed/98ccb3a9361a3748f8ba170578d2e8fa/
/raw/98ccb3a9361a3748f8ba170578d2e8fa/
98ccb3a9361a3748f8ba170578d2e8fa
php
PHP
7
2019-06-08T04:10:42
True
False
False
/api/public/snipt/471/
using-_get-to-get-id
<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> <a href="#L-7">7</a></pre></div></td><td class="code"><div class="highlight"><pre><span></span><span id="L-1"><a name="L-1"></a><span class="cp">&lt;?php</span> </span><span id="L-2"><a name="L-2"></a> </span><span id="L-3"><a name="L-3"></a><span class="nv">$id</span> <span class="o">=</span> <span class="nv">$_GET</span><span class="p">[</span><span class="s1">&#39;id&#39;</span><span class="p">];</span> </span><span id="L-4"><a name="L-4"></a> </span><span id="L-5"><a name="L-5"></a><span class="k">echo</span> <span class="nv">$id</span><span class="p">;</span> </span><span id="L-6"><a name="L-6"></a> </span><span id="L-7"><a name="L-7"></a><span class="cp">?&gt;</span><span class="x"> </span> </span></pre></div> </td></tr></table>
get, id, php

PHP

Prettyize Money

1
2
3
4
5
6
<?php

  setlocale(LC_MONETARY, 'en_US');
$total_formatted = money_format('%(#10n', $total) . "\n";

?>
https://snipt.net/embed/83bc0d90acbfa9c0297b56b4a5833114/
/raw/83bc0d90acbfa9c0297b56b4a5833114/
83bc0d90acbfa9c0297b56b4a5833114
php
PHP
6
2019-06-12T23:07:37
True
False
False
/api/public/snipt/444/
prettyize-money
<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="cp">&lt;?php</span> </span><span id="L-2"><a name="L-2"></a> </span><span id="L-3"><a name="L-3"></a> <span class="nb">setlocale</span><span class="p">(</span><span class="nx">LC_MONETARY</span><span class="p">,</span> <span class="s1">&#39;en_US&#39;</span><span class="p">);</span> </span><span id="L-4"><a name="L-4"></a><span class="nv">$total_formatted</span> <span class="o">=</span> <span class="nb">money_format</span><span class="p">(</span><span class="s1">&#39;%(#10n&#39;</span><span class="p">,</span> <span class="nv">$total</span><span class="p">)</span> <span class="o">.</span> <span class="s2">&quot;</span><span class="se">\n</span><span class="s2">&quot;</span><span class="p">;</span> </span><span id="L-5"><a name="L-5"></a> </span><span id="L-6"><a name="L-6"></a><span class="cp">?&gt;</span><span class="x"></span> </span></pre></div> </td></tr></table>
money, php