title: PHP in Javascript if mobile device
body: <p>i have question, that i can't  answer by myself. 
  I want to do the PHP code if a visitor is using mobile device. But, the problem is, that it execute the PHP code even if I'm one the PC.</p>
  
  <pre><code>  if( /Android|webOS|iPhone|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent) ) {
        document.write("
          &lt;?php 
  
              if(isset($_COOKIE['web'])){
                  /* nothing */
              }
              else {
                  header("Location: /choose.php");
              }
          ?&gt;
        ");
    }
  </code></pre>
  
  <p>Idea is to use PHP for detecting device, but some people told me that it's not working properly.
  Thank's for response !</p>