snipt

Ctrl+h for KB shortcuts

PHP

PHP convert binary to hex

1
2
3
4
<?
//convert binary to hex
echo "bin2hex ".bin2hex("1")."\n";
?>
https://snipt.net/embed/150e181807d31b1bdce146433cf2a936/
/raw/150e181807d31b1bdce146433cf2a936/
150e181807d31b1bdce146433cf2a936
php
PHP
4
2019-06-20T22:23:59
True
False
False
/api/public/snipt/8696/
php-convert-binary-to-hex
<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></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;?</span> </span><span id="L-2"><a name="L-2"></a><span class="c1">//convert binary to hex</span> </span><span id="L-3"><a name="L-3"></a><span class="k">echo</span> <span class="s2">&quot;bin2hex &quot;</span><span class="o">.</span><span class="nb">bin2hex</span><span class="p">(</span><span class="s2">&quot;1&quot;</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-4"><a name="L-4"></a><span class="cp">?&gt;</span><span class="x"></span> </span></pre></div> </td></tr></table>
binary, hex, php

PHP

convert binary to decimal

1
2
3
4
<?
//convert binary to decimal
echo "bindec ".bindec('110011') . "\n";
?>
https://snipt.net/embed/6f0692182f69b13c449a1b7aa6aa3716/
/raw/6f0692182f69b13c449a1b7aa6aa3716/
6f0692182f69b13c449a1b7aa6aa3716
php
PHP
4
2019-06-27T03:23:19
True
False
False
/api/public/snipt/8694/
convert-binary-to-decimal
<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></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;?</span> </span><span id="L-2"><a name="L-2"></a><span class="c1">//convert binary to decimal</span> </span><span id="L-3"><a name="L-3"></a><span class="k">echo</span> <span class="s2">&quot;bindec &quot;</span><span class="o">.</span><span class="nb">bindec</span><span class="p">(</span><span class="s1">&#39;110011&#39;</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-4"><a name="L-4"></a><span class="cp">?&gt;</span><span class="x"></span> </span></pre></div> </td></tr></table>
binary, decimal, php