/ Published in: PHP
Here's a handy (relatively undocumented) tip. PHP supports the following method of assigning strings (borrowed from Perl)
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
$string = <<<ENDOFSTRING 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;