Get the App
SLTechnology News&Howtos  ›  Development  › 

What is the link character and how to use it in php

Shulou Source: shulou.com Published: 2022-05-31 16:33:16 09月21日 Update

This article mainly explains "what is the link in php and how to use it". The content in the article is simple and clear, and it is easy to learn and understand. Please follow the editor's train of thought to study and learn "what is the link in php and how to use it".

In php, a link refers to the symbol of a linked string, which is used to concatenate characters and can concatenate two or more strings into a new string. There are two kinds of PHP linkers: 1. The connector is just a simple concatenation string; 2, the ". =" operator, which can be spliced and assigned, can append the string (variable) on the right to the left.

Operating environment of this tutorial: windows7 system, PHP7.1 version, DELL G3 computer

In php, a link refers to the symbol of a linked string, which is used to concatenate characters and can concatenate two or more strings into a new string.

For example, put the following two strings:

$str1= "hello"; $str2= "world"

Concatenate into a string:

Helloworld

There are two types of PHP linkers:

"." Connector

". =" operator

1. Connector

Is a simple concatenation string, syntax:

String1.string2.string3. .stringN

The operation in the above example can be as follows:

$str1= "hello"; $str2= "world"; $str=$str1.$str2;echo $str

You can also add a delimiter between two strings

Echo $str1. ". $str2;echo $str1." -. $str2

2. ". =" operator

". =" is an assignment operator that appends the string (variable) to the right of the operator to the left to form a new value and then assign it to the left. Syntax:

$string = string1;$string. = string2;$string. = string3; $string. = stringN

The operator ". =" is more convenient to concatenate two strings, but it is not good to concatenate more than one string at a time. Fu.

Example:

$str1= "hello"; $str2= "world"; $str1.=$str2;echo $str1

When you concatenate two strings with the ". =" operator, you cannot add a delimiter in the middle.

Thank you for reading, the above is the content of "what is the link in php and how to use it". After the study of this article, I believe you have a deeper understanding of what the link in php is and how to use it, and the specific use needs to be verified in practice. Here is, the editor will push for you more related knowledge points of the article, welcome to follow!

Tags: Characters strings links two operators operations learning functions content delimiters variables right that is symbols syntax no one-time just multiple ideas Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Shulou Tech Info MariaDB Redmi MySQL Xiaomi