Okay, so maybr I’m going about doing this entirely wrong, I probably am. But I would like to be able to take the HTML between a … like so:
$str = ?>
... some HTML goes here ...
<?php ;
Am I completely off my rocker to think I can do this? I couldn’t think of a way to put it into words so I could search it on Google, which is why I’m here…
You can use output buffering:
Alternatively, if it’s just a little bit of HTML (and no php code within), just write it down with one of the string formats like heredoc or nowdoc: