Suppose I have a large string of HTML code. It has both double quotes and single quotes. How can I work with such a string? I want to assign it to a php var
but the
You could use HEREDOC/NOWDOC:
$var = <<<HTML
<div class="name">Sally O'Connel</div>
HTML;
$var = file_get_contents('file.with.your.long.and.windy.html');
would be apparently the only sane way. PHP files are for the code.
use Heredoc
$var = <<<HTML
<div class="name">Sally O'Connel</div>
HTML;
Please ensure that there is no space character after HTML;