title: How to access PHP variables in JavaScript or jQuery rather than <?php echo $variable ?>
body: <p>How do I access PHP variables in JavaScript or jQuery? Do I have to write </p>
  
  <pre><code>&lt;?php echo $variable1 ?&gt;
  &lt;?php echo $variable2 ?&gt;
  &lt;?php echo $variable3 ?&gt;
  ...
  &lt;?php echo $variablen ?&gt;
  </code></pre>
  
  <p>I know I can store some variables in cookies, and access these values via cookies, but values in cookies are relatively stable values. Moreover, there is a limit, you can not store many values in cookies, and the method is not that convenient. Is there a better way to do it?</p>