Many times we need to connect severalstringsfor display. In PHP, "dots" are used to connect strings, that is, in English period ".", the specific usage is as follows:
There is another way to connect strings, which is a bit like the placeholder of "printf" in C symbol, but PHP directly writes thevariable nameto the placeholder. The method of use is to add curly brackets before and after the variable. When displayed, the part of the string that is not enclosed by curly brackets will still be output directly, and the enclosed part will be replaced and output with the corresponding string according to the variable name. You can look at the following example to make it clearer, pay attention to the underlined part:
The above is the detailed content of Detailed explanation of simple examples of php string connection. For more information, please follow other related articles on the PHP Chinese website!