Wednesday, 11 September 2013

PHP code in apostrophes?

PHP code in apostrophes?

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.

No comments:

Post a Comment