title: Why php variable cant work with javascript loop?
body: <p>I expected that the number will increase on every alert, but it ended up being the same number which is 0.</p>
  
  <p>Can I know why ?</p>
  
  <p>I need to do this because in my real code, $wow represent the value I retrieved from server and I need to use javascript for loop to count the number element which I targeted.</p>
  
  <p>How can i do this ?</p>
  
  <p>Here is my Code : </p>
  
  <pre><code>&lt;html&gt;
  &lt;head&gt;
  &lt;script&gt;
  &lt;?php $wow = 0; ?&gt;
  for(var i =0; i &lt; 4; i++){
     alert("&lt;?php echo $wow; ?&gt;");
      &lt;?php $wow++; ?&gt;
      }
  &lt;/script&gt;
  &lt;body&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>