In PHP, the dot equals ".=" means "splicing characters", and the syntax "String 1.=String 2" is to append the string on the right side of the equal sign to the string on the left After that, the two strings are concatenated into a new string and assigned to the variable on the left.
The operating environment of this tutorial: windows7 system, PHP7.1 version, DELL G3 computer
In php, the dot is equal to " .=
" means "splicing character", which can splice two strings into a new string.
Syntax:
$string1 .= string2;
will append the string on the right side of the equal sign to the left string.
<?php header("Content-type:text/html;charset=utf-8"); $str = '欢迎访问“PHP中文网” '; $str .= '网址:https://www.php.cn/ '; $str .= '一个在线学习编程的网站'; echo $str; ?>
In addition to using ".=", you can also use the "." connector to splice two or more strings into one new string.
Grammar:
$string = string1.string2.string3. ······ .stringn;
Example:
<?php header("Content-type:text/html;charset=utf-8"); $str1 = '欢迎访问“PHP中文网” '; $str2 = '网址:https://www.php.cn/ '; $str3 = '一个在线学习编程的网站'; $str=$str1.$str2.$str3; echo $str; ?>推荐学习:《
The above is the detailed content of What does php dot equal mean?. For more information, please follow other related articles on the PHP Chinese website!