문자 출력 <<<EOD

Language/PHP 2010. 5. 24. 09:27

<?php
$str 
= <<<EOD
Example of string
spanning multiple lines
using heredoc syntax.
EOD;

/* More complex example, with variables. */
class 
foo
{
    var 
$foo
;
    var 
$bar
;

    function 
foo
()
    {
        
$this->foo 'Foo'
;
        
$this->bar = array('Bar1''Bar2''Bar3'
);
    }
}

$foo = new foo
();
$name 'MyName'
;

echo <<<EOT
My name is "$name". I am printing some $foo->foo
.
Now, I am printing some 
{$foo->bar[1]}
.
This should print a capital 'A': \x41
EOT;
?>

'Language > PHP' 카테고리의 다른 글

외부 링크 방지  (0) 2010.05.25
echo 를 이용한 문자 와 변수 출력 방법  (0) 2010.05.24
mysql_connect 접속 및 에러코드 확인  (0) 2010.05.24
array_count_values  (0) 2010.05.18
addslashes / stripslashes  (0) 2010.05.18
: