Home > Article > Backend Development > What does it mean to add a dot before and after a variable in PHP?
In PHP, adding a "." dot before and after a variable means to connect the variable with the content before and after; the connector "." is used to connect several strings for display, and dots are used between strings. To connect, that is, the half-width period "." in English, you can connect two or more strings into one string.
The operating environment of this article: Windows 10 system, PHP version 7.1, Dell G3 computer.
PHP adds a dot after defining a variable to connect strings
PHP uses dots. to connect strings
$str1="Hello"; $str3=$str1."World";// $str3==Hello Word
Many times we need to connect several strings for display. In PHP, "dots" are used to connect strings, which is the half-width period "." in English. " . " is a string concatenation operator that can link two or more strings into one string. For example:
<?php $name = "好好学习,"; $url = "天天向上"; echo $name . $url . "。"; ?>
The output result is: study hard and make progress every day.
Recommended learning: "PHP Video Tutorial"
The above is the detailed content of What does it mean to add a dot before and after a variable in PHP?. For more information, please follow other related articles on the PHP Chinese website!