0

I've stumbled across some code that looks like it's alternate syntax for assigning something into a variable in PHP.

$VSWTags = <<<VSW
BUNCHOFHTMLANDSTUFFHERE
VSW;

This is in a Drupal site we have here at work, and I searched on PHP.net for the VSW and for the <<< I couldn't find anything. When I played with it in the console I saw that it basically is just support for bare words or something of that nature?

php > $s = <<<VSW                                                               <<< > I dont know what this is doing
<<< > but its cool
<<< > VSW;
php > print $s;
I dont know what this is doing
but its cool
php > 

Does anyone know where the documentation is for this or what it's called?

EdgeCaseBerg
  • 2,761
  • 1
  • 23
  • 39
  • Ah, thank you jeroen! The documentation for the HEREDOC is here: http://php.net/manual/en/language.types.string.php#language.types.string.syntax.heredoc – EdgeCaseBerg Apr 23 '15 at 15:57

1 Answers1

0

This is HEREDOC - very usefull for large strings.

Nemutaisama
  • 591
  • 2
  • 8
  • Thanks Nemutaisama, I have to wait 6 minutes before I can accept an answer, but I'll accept this one when I can if the question isn't removed as a duplicate. – EdgeCaseBerg Apr 23 '15 at 15:58