note 60253 deleted from language.types.string by felipe
| From: | felipe@php.net | Date: | Sun, 23 Mar 2008 23:14:46 +0000 |
| Subject: | note 60253 deleted from language.types.string by felipe | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-137440@lists.php.net to get a copy of this message | ||
Note Submitter: csaba at alum dot mit dot edu
----
Multiline strings:
In most of the strings on this doc page, the heredoc form (<<<) is not needed. The heredoc
form is useful when you also want to embed, without escaping, quotes of the same type as the
starting quote. The single quote form is particularly useful when you want to specify multiline
code for future evaluation.
<?php
$code = '
$output = "Mutliline output";
$out = "$output within multiline code:
$ needs escaping within \$out,
and double quotes (\") need escaping within \$out,
but single quotes (\') need escaping everywhere.";
// Next two lines work with php.exe
/* on Windows systems */
$oWSH = new COM("WScript.Shell");
$oWSH->Popup($out, 4, \'IO Demo\', 131120);
';
print "<pre>$code</pre>";
call_user_func (create_function('', $code));
?>
Happy New Year,
Csaba Gabor from Vienna