PHP Data type

Source: Internet
Author: User

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



Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.