Return to Snippet

Revision: 28665
at July 12, 2010 09:25 by Snaver


Initial Code
$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;

Initial URL

                                

Initial Description
Here's a handy (relatively undocumented) tip. PHP supports the following method of assigning strings (borrowed from Perl)

Initial Title
ENDOFSTRING PHP Strings

Initial Tags
php

Initial Language
PHP