0

I came across some code in a file I was working that basically has

echo <<<output

"some html here"

output;

What does this do? Normally I do something like

echo "some html here";

but I've run into some cases where I have to use both ' and " and then it breaks the statement to echo, I think the first method would be a way around this but I would like to know what it's actually doing.

Thanks in advance.

Brandon Shega
  • 769
  • 4
  • 17
  • http://php.net/manual/en/language.types.string.php#language.types.string.syntax.heredoc – AbraCadaver Oct 09 '14 at 15:26
  • Great, thank you! I was googling with the word output as I thought this was part of the syntax but apparently it doesn't matter what word you use. Thanks again! – Brandon Shega Oct 09 '14 at 15:28

1 Answers1

0

You are looking at heredoc notation.

A third way to delimit strings is the heredoc syntax: <<<. After this operator, an identifier is provided, then a newline. The string itself follows, and then the same identifier again to close the quotation.

andy
  • 2,002
  • 1
  • 12
  • 21