tags:

views:

75

answers:

3

In the following code from http://us2.php.net/manual/en/language.oop5.properties.php what does the <<< symbol mean?

<?php
class SimpleClass
{
   // invalid property declarations:
   public $var1 = 'hello ' . 'world';
   public $var2 = <<<EOD
hello world
EOD;
   public $var3 = 1+2;
   public $var4 = self::myStaticMethod();
   public $var5 = $myVar;

   // valid property declarations:
   public $var6 = myConstant;
   public $var7 = array(true, false);

   // This is allowed only in PHP 5.3.0 and later.
   public $var8 = <<<'EOD'
hello world
EOD;
}
?>
+3  A: 

A string in Heredoc syntax.

KennyTM
+3  A: 

It's called Heredoc syntax and can be used to assign string values.

Tatu Ulmanen
What are the benefits of assigning strings in this fashion?
Doodle
For 1 is that you do not have to worry about new line operators.
Bastiaan Linders
+2  A: 

It's just another way to define a String (Newdoc/Heredoc syntax) - Manual - String

Crozin