From the manual:
Nowdocs are to single-quoted strings what heredocs are to double-quoted strings. A nowdoc is specified similarly to a heredoc, but no parsing is done inside a nowdoc. The construct is ideal for embedding PHP code or other large blocks of text without the need for escaping.
Look that the difference between those 2 is that nowdocs uses single quotes when defining the tag (that can be anything you want) and heredocs doesn’t.
$foo = 'bar'; $now = <<<'NOW' I'm now, $foo! NOW; $here = <<<HERE I'm here, $foo! HERE;
In this case:
$now
is "I'm now, $foo!"
$here
is "I'm here, bar!"
Ref: http://php.net/manual/en/language.types.string.php#language.types.string.syntax.nowdoc
http://stackoverflow.com/a/11153164
0 Comments.