Home > Backend Development > PHP Problem > 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
Release: 2023-03-15 14:38:01
Original
4113 people have browsed it

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

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

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!

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