A nice way of being able to do both is by using the following. This is only really useful for big blocks of text as it uses 3 or more lines.
Code:
echo <<< HTML
This can contain $variables and " and nothing needs escaping :)
HTML;
//or we can store it in a variable to start with
$another_variable = <<< MOREHTML
some more text with variables $my_html and "
MOREHTML;
//HTML and MOREHTML can be any label you want.
Yep thats what i meant. Its only good if theres no variables to print Should be used if theres no variables though as its slightly faster than a double quoted string.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.