PHP uses two types of data:
1, the number: including integral type, floating points.
Decimal: If you see 15 o'clock, it means (1*10+5) or 1510
Contains (0 ... 9) 10 digits
Octal: If you see 15 o'clock, it means (1*8+5) or 158 or 1310
Contains (0 ... 7) Eight digits
Hexadecimal: If you see 15 o'clock, it means (1*16+5) or 1516 or 2110
Contains (0 ... 9,A,B,C,D,E,F) 16 digits
2, Text: That is, as a processing unit of a string of characters.
2.1. Single quote string
Enclose the text you want to use in single quotes.
such as: ' I am siron. '
? : If I am going to write this, the book is highly enjoyable. How do you write that?
2.2, double quote string
Use double quotes to enclose the text you want to use, but it's more complicated. You can use variable substitution in double quotes.
such as: "I am Siron."
? : If I want to write Tom said, "Gifts are great." How do you write that?
Note: There are two problems ahead, is not simple to use single, double quotes can be resolved?
No, this will cause errors!!!
We have to mention the escape character "\": the function of the character immediately following will be ignored.
So, the 2.1 question can be written like this: ' This\ ' s book is highly enjoyable. '
2.2 of the questions can be written like this: "Tom said,\" Gifts are great.\ ""
Let's look at a larger difference between a single quote string and a double quote string:
You can add a special escape sequence in a double quote string
The escape sequence list is as follows:
Escape sequence |
Describe |
\ n |
Line Wrap |
\ r |
Enter |
\ t |
Tabs |
\$ |
Dollar sign |
\0nnn |
Any 18 in number |
\xnn |
Any number of hexadecimal digits |
\\ |
Backslash character |
Note: PHP uses "$" to define variables, so when you write "$", you use the escape character.
2.3, inverted quote character
PHP runs system commands with an inverted quote string