Detailed explanation of simple examples of php string connection

伊谢尔伦
Release: 2023-03-11 16:02:01
Original
1881 people have browsed it

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:

Copy after login


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:


Copy after login


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!

Related labels:
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
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!