0

I've been a developer for sometime now and I've recently seen the following syntax inline in PHP code

<<< XML...
XML;

It can also be be done with HTML and TXT. What is this syntax referred to as and what does it do in terms of its process

Kendall
  • 5,065
  • 10
  • 45
  • 70
  • That's called a [Heredoc](http://www.php.net/manual/en/language.types.string.php#language.types.string.syntax.heredoc). – Michael Berkowski Oct 15 '13 at 12:59
  • Incidentally, it isn't related to XML, HTML, or TXT specifically. The identifier can be any arbitrary string (within the allowed character limits described in the docs) so you'll often see things like `echo << – Michael Berkowski Oct 15 '13 at 13:01

1 Answers1

0

That would be called a Heredoc

Clark T.
  • 1,470
  • 2
  • 11
  • 25
  • Thanks if you "include 'file.txt' between this heredoc syntax which is based on a file name would it be treated as such? – Kendall Oct 15 '13 at 13:21
  • im not positive on that one but i believe it only accepts variables so if you did $file = include ('file.txt'); then did $file in it, that would work but don't quote me on it. – Clark T. Oct 15 '13 at 16:32