In the previous article, we learned how to get the length of a string. If you need it, please read "How to know the length of a string in php". This time we will introduce to you the string operators of PHP. You can refer to them if you need them.
First we understand string variables. After understanding string variables, we can better introduce string operators.
String variables are used for values that contain characters. After creating the string, we can operate on it. You can use the string directly in the function or store it in a variable.
There’s no way to understand it simply. Let’s look at an example.
<?php $txt="世界盛大,欢迎回家!"; $offer="World grand, welcome home!"; echo $txt; echo "<br>"; echo $offer; ?>
The result of this example is
#It should be noted that when assigning a text value to a variable, please remember to add # to the text value. ##Single quotes or
Double quotes, just like the example above.
<?php $txt="世界盛大,欢迎回家!"; $offer="World grand, welcome home!"; echo $txt . $offer; echo "<br>"; echo $txt; echo $offer; ?>
.” between variables. In this way, the function of “.” is to separate the original two sentences. into a sentence?
The above is the detailed content of What is the concatenation operator in php?. For more information, please follow other related articles on the PHP Chinese website!