Home > Backend Development > PHP Problem > What does php dot equal mean?

What does php dot equal mean?

青灯夜游
Release: 2023-03-15 08:26:01
Original
3950 people have browsed it

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;
Copy after login

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;
?>
Copy after login

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;
Copy after login

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;
?>推荐学习:《
Copy after login

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!

Related labels:
php
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template