note 60253 added to language.types.string
| From: | csaba at alum dot mit dot edu | Date: | Sat, 31 Dec 2005 11:15:31 +0000 |
| Subject: | note 60253 added to language.types.string | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-101042@lists.php.net to get a copy of this message | ||
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
----
Manual Page -- http://www.php.net/manual/en/language.types.string.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+60253
Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+60253&report=yes&reason=added+to+the+manual
Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+60253&report=yes&reason=bad+code
Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+60253&report=yes&reason=spam
Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+60253&report=yes&reason=useless
Delete: non-english -- http://master.php.net/manage/user-notes.php?action=delete+60253&report=yes&reason=non-english
Delete: already in docs -- http://master.php.net/manage/user-notes.php?action=delete+60253&report=yes&reason=already+in+docs
Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+60253&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+60253&report=yes
Search -- http://master.php.net/manage/user-notes.php