arguments - PHP and - 参考-这个符号在PHP中是什么意思?

PHP operator precedence / php / logic / operators / symbols

这是一个关于PHP语法问题的集合。这也是一个社区维基,所以每个人都被邀请参与维护这个列表。

119 revs, 60 users 50%



Answer #1

1)单引号字符串:

$string = 'This is my string'; // print This is my string

2)双引号字符串:

$str = 'string';

$string = "This is my $str"; // print This is my string

3) Heredoc:

$string = <<<EOD
This is my string
EOD; // print This is my string

4)Nowdoc(自PHP 5.3.0起):

$string = <<<'END_OF_STRING'
    This is my string 
END_OF_STRING; // print This is my string