title: How to obfuscate JavaScript on the server side?
body: <p>I have a script I want to obfuscate or encrypt to hide from competition viewing the source code.  I have found simple JS obfuscators but the issue with my script is I have PHP echoing variables into the JavaScript.  The PHP is echoing strings and true/false.</p>
  
  <p>Here is a piece of the JavaScript with PHP in it.</p>
  
  <pre><code>function redirect() {
      var r = &lt;?php echo $rvar; ?&gt;;
      if (r) {
          window.location = prepare("&lt;?php echo $redirect; ?&gt;");
      }
  }
  </code></pre>
  
  <p>Can someone tell me what I can do to hide my JavaScript but be able to dynamically build the JS with PHP?</p>