运行下面代码,尤其是第三行,如果 . 左右存在空格,那么即使是一个数字,也将会作用成字符串连接。
echo "thr"."ee"; //prints the string "three"
echo "twe" . "lve"; //prints the string "twelve"
echo 1 . 2; //prints the string "12"
echo 1.2; //prints the number 1.2
echo 1+2; //prints the number 3
来源: https://www.php.net/manual/zh/language.operators.string.php#41950