title: mix javascript and php
body: <p>I have a file called: <strong>file.php</strong></p>
  
  <p>contained in this file is the following code:</p>
  
  <pre><code>&lt;script type="text/javascript"&gt;
          //....
          var sumJS = 10;
      &lt;?php $sumPHP = sumJS  ?&gt;
  &lt;/script&gt;
      &lt;?php echo "Sum = " . $sumPHP ?&gt;
  </code></pre>
  
  <p>How can I assign sumJS for $sumPHP?</p>
  
  <p>If I would like to make this conversely then I would write:</p>
  
  <pre><code>  $sumPHP = 10;
  &lt;script type="text/javascript"&gt;
      var sumJS;
      sumJS = &lt;?php echo $sumPHP ?&gt;;
      alert(sumJS);
  &lt;/script&gt;
  </code></pre>
  
  <p>But how can I re-make this for my problem?</p>