2010-05-06 13 views
6

다음 코드에서 http://us2.php.net/manual/en/language.oop5.properties.php은 무엇입니까? < < < 기호는 무엇을 의미합니까?PHP <<<는 무슨 뜻입니까?

<?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; 
} 
?> 
+0

코드가 잘못이다 -은'EOD는,'라인 들여 쓰기 수 없습니다. 연결된 페이지에는 해당 부분 들여 쓰기가 없습니다. – Amber

답변

5

Heredoc syntax이라고하며 문자열 값을 할당하는 데 사용할 수 있습니다.

그것은 문자열 (Newdoc/히어 닥 문법)를 정의하는 또 다른 방법
+0

이 방식으로 문자열을 할당하면 어떤 이점이 있습니까? – Prospero

+0

1은 새로운 회선 운영자에 대해 걱정할 필요가 없다는 것입니다. –

+0

따옴표를 이스케이프하지 않아도됩니다. –