title: Uncaught reference error for echo function in php
body: <p>I have used the follwoing php code snippet inside a java script code(inside a parent html). </p>
  
  <pre><code>&lt;script&gt;
      function setOptions(d) {
          &lt;?php
              echo "test";
          ?&gt;
      }
  &lt;/script&gt;
  </code></pre>
  
  <p>When the content is saved and the web page is refreshed, I get the following error,</p>
  
  <p>Uncaught ReferenceError: test is not defined</p>
  
  <p>Note- echo works when directly used inside the html code.</p>
  
  <p>Any idea on how to fix this problem?</p>