开发者

Php what does <<< mean?

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

<?ph开发者_开发知识库p
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;
}
?>


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


A string in Heredoc syntax.


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

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜