What's the preferred way of outputting PHP code within apostrophes? For example this JavaScript code would break and the second line will be totally empty:
var jsString = '<div id="content">'+'<?php echo $something['1'] ?>'+'</div>';
Thanks! I know this is kind of basic and I know how to fix it, but I'm wondering how to do it the right way?
[edit]
I know it looks obvious, but $something["1"]
won't work. The same goes for $something[\'1\']
.
'>` and it would be the same question.
– kennypu Sep 11 '13 at 23:18