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;
}
?>
它被称为Heredoc语法 ,可用于分配字符串值。
Heredoc语法中的字符串。
它只是定义String(Newdoc / Heredoc语法)的另一种方法 - Manual - String
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.