PHP entry variable string, PHP entry variable_PHP tutorial

WBOY
Release: 2016-07-12 09:00:00
Original
896 people have browsed it

PHP entry variable string, PHP entry variable

A string is just a block of characters enclosed in quotation marks: letters, numbers, spaces, punctuation marks, etc.

All listed below are strings:

?
1 2 3 4 'Huige' "In watermelon sugar" '100' 'August 2, 2011'

FAQ:

【1】When creating a string, you can use single quotes or double quotes to encapsulate characters. In addition, the same type of quotes must be used at the beginning and end of the characters.

【2】If the same quotation mark appears in the middle of the string, you can place a backslash in front of the problematic character (the problematic character here is a double quotation mark, and you will learn about other problematic characters later) , which escapes:

?
1 2 3 <?php $var = "Define "platitude", please."; ?>

Another way is to use single quotes (this way you use single quotes when printing double quotes and vice versa):

?
1 2 3 <?php $var = 'Define "platitude", please.'; ?>

【3】If the same variable is assigned twice (for example: $book), the new value will overwrite the old value.

?
1 2 3 4 <?php $book = 'High Fidelity'; $book = 'The Corrections'; ?>

Print the result yourself, so you can verify whether the new value overwrites the old value.

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/1095122.htmlTechArticlephp entry variable string, php entry variable string is just a block of characters enclosed in quotation marks: letters, numbers , spaces, punctuation marks, etc. All listed below are strings...
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template