snipt

Ctrl+h for KB shortcuts

PHP

detect iphone browser

1
2
3
4
< ?php
$browser = strpos($_SERVER['HTTP_USER_AGENT'],"iPhone");
if ($browser == true)  { echo 'Code You Want To Execute'; }
?>
https://snipt.net/embed/94e9ef8d3e0da48dad0b4df25019e76b/
/raw/94e9ef8d3e0da48dad0b4df25019e76b/
94e9ef8d3e0da48dad0b4df25019e76b
php
PHP
4
2019-07-24T00:14:14
True
False
False
/api/public/snipt/25064/
detect-iphone-browser-1
<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="x">&lt; ?php</span> </span><span id="L-2"><a name="L-2"></a><span class="x">$browser = strpos($_SERVER[&#39;HTTP_USER_AGENT&#39;],&quot;iPhone&quot;);</span> </span><span id="L-3"><a name="L-3"></a><span class="x">if ($browser == true) { echo &#39;Code You Want To Execute&#39;; }</span> </span><span id="L-4"><a name="L-4"></a><span class="x">?&gt;</span> </span></pre></div> </td></tr></table>
browser, detect, iphone, php