本教程操作环境:windows7系统、php7.1版,dell g3电脑。
php变量和字符串连接符——点
连接符——点,本身也是一种运算符。它真正的名字应该叫“字符运算符”。作用是把两个字符串连接起来。
echo 字符 . 变量 . 字符;
//点号把三个值连接成为一个,运行正常。
例1:
1.字符串+变量+字符串echo("<!--".$result."-->");2.变量+变量echo($result.$result);3.字符串+变量echo("a".$result);
例2
.串接
$txt1 = "hello" $txt2 = $txt1 . " world!"
现在 $txt2 包含 "hello world!"
输出:
hello world!
以上就是php中.的用法的详细内容。
