字符串连接运算符是为了将两个字符串进行连接,PHP中提供的字符串连接运算符有:
(1)连接运算符(“.”):它返回将右参数附加到左参数后面所得的字符串。
(2)连接赋值运算符(“.=”):它将右边参数附加到左边的参数后。
[html] view plain copy
<?php
$a = "Hello " ;
$b = $a . "World!" ; // now $b contains "Hello World!"
$a = "Hello " ;
$a .= "World!" ; // now $a contains "Hello World!"
?> <?php
$a = "Hello " ;
$b = $a . "World!" ; // now $b contains "Hello World!"
$a = "Hello " ;
$a .= "World!" ; // now $a contains "Hello World!"
?>