Can this be done – opening a variable with one PHP tag, then closing the PHP tag but keeping the variable open so everything beneath becomes the value of the variable? Or is there a limit on PHP variable size / characters?
<?php $content = " ?>
a bunch of content goes here <br />
with lots of HTML tags and JS scripts
<?php "; ?>
What your code would do is to store a string starting with
?>and ending with<?phpin the variable$content. That’s probably not what you want to do? If you later echo such a string, you would most probably get errors due to these php tags.As mentioned in other answers, heredoc would be a solution but in general you should try to avoid such situations where you have to store very long html sequences in a variable. Rather use a view file and inject some dynamic content there or use some sort of include.
So, depending on what you really want to do,your options are:
$content = "<html>markup here</html>";