End of String
This useful codesnippet can be used to create long strings, without having to escape ’single’ or “double” quotes, but $variables can still be parsed. Very useful for very long texts.
$string = << This is a string
It can include both 'single' and "double" quotes
without needing to escape them. However, $variables
will still be interpolated as they are in double
quoted strings. Complex variable expressions such as
{$array['element']} or {$object->property} can also
be included and will be evaluated if they are included
in curly braces (they may work without curly braces
but I tend to include them for added clarity). The
string will terminate with whatever you specified
at the start like this:
ENDOFSTRING;
?>