title: PHP Array in Javascript Variable - JS Element
body: <p>I have a Javascript variable which I am setting a PHP variable to.</p>
  
  <pre><code>function cancel(number) {
      var message = "&lt;?= $message[" + number + "]; ?&gt;";
  }
  </code></pre>
  
  <p>$message is an array. "number" is the element of the array I want to set message to. Basically, I want to set a Javascript variable to a PHP variable using a Javascript variable as the element picker. So if "number" was 2, it would select:</p>
  
  <pre><code>$message[2];
  </code></pre>
  
  <p>However, the above approach doesn't work, and I'm not even sure if this is possible.</p>