Home  >  Article  >  Backend Development  >  What does php dot equal mean?

What does php dot equal mean?

青灯夜游
青灯夜游Original
2022-02-10 11:40:413880browse

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.

What does php dot equal mean?

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 = &#39;欢迎访问“PHP中文网”  &#39;;
$str .= &#39;网址:https://www.php.cn/ &#39;;
$str .= &#39;一个在线学习编程的网站&#39;;
echo $str;
?>

What does php dot equal mean?

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 = &#39;欢迎访问“PHP中文网”  &#39;;
$str2 = &#39;网址:https://www.php.cn/ &#39;;
$str3 = &#39;一个在线学习编程的网站&#39;;
$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!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn