Home  >  Article  >  Backend Development  >  What does it mean to add a dot before and after a variable in PHP?

What does it mean to add a dot before and after a variable in PHP?

WBOY
WBOYOriginal
2022-03-04 10:07:394104browse

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.

What does it mean to add a dot before and after a variable in PHP?

The operating environment of this article: Windows 10 system, PHP version 7.1, Dell G3 computer.

What does it mean in PHP to add a dot before and after a variable?

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!

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