title: PHP in javascript in PHP
body: <p>I want to call a javascript function from my PHP code. I have achieved this by using:</p>
  
  <pre><code>echo '&lt;script type="text/javascript"&gt; drawChart($id); &lt;/script&gt;';
  </code></pre>
  
  <p>This works fine, but I want to get data from my PHP code, which I did using the following: </p>
  
  <pre><code>var t_array = ?php echo json_encode($t_array); ?&gt;;
  </code></pre>
  
  <p>(Yes, I know there's a > missing.) I think the PHP closing tag is interfering with the rest of the code. So now my question:
  How can I get PHP data without using the PHP tags?</p>
  
  <p>Thanks in advance</p>