title: Calling Javascript function in PHP while passing PHP variables into the function
body: <p>I'm experiencing a problem when calling a JavaScript function inside PHP code and trying to pass my PHP variables as parameters into the function. While it seems really simple to me, I can't figure it out by trying different syntax.</p>
  
  <p>Here is a sample code which can demonstrate the problem:</p>
  
  <pre><code>&lt;?PHP
      $var1 = 0;
      $var2 = 1;
      $var3 = 2;
      echo '&lt;script type="text/javascript"&gt;functionName($var1, $var2, $var3);&lt;/script&gt;';
  ?&gt;
  </code></pre>
  
  <p>If I try to pass constants (e.g. "123") the function gets called and the value is passed, but when trying to pass the PHP variable, the function doesn't get called at all.</p>
  
  <p>How can I do this correctly?</p>