What is <<<_END?

Skoder picture Skoder · Jan 13, 2011 · Viewed 20.8k times · Source

I'm new to PHP and don't understand what the point of <<<_END is. Could someone please explain when this should be used? I've looked at various examples and they all seem to have HTML embedded within them. But I can use HTML without the <<<_END tags, so why should I use them? I tried searching the manual, but I keep finding the end() method for arrays.

Answer

Mitch Dempsey picture Mitch Dempsey · Jan 13, 2011

It's the start of a heredoc. you can do:

$data = <<< _END

You can write anything you want in between the start and end

_END;

_END can be just about anything. You could put EOF or STUFF. as long as you use the same thing at the start and the finish.