PHP Basics-Data types

Source: Internet
Author: User
Tags php basics type null

1. Boolean type (BOOL):

Boolean type, which is true or false.

The following conditions are determined to be false:


      • Boolean value Flase

      • Integral type 0 is False

      • Floating-point 0.0

      • An array with no member variables

      • Special type NULL



2. Integral type (int):

Range 2147483647~-2147483648

If a given range exceeds this range, it will be considered floating-point.

3. Float type (float):

Contains the number of fractional parts. Range 1.7e-38~1.7e+38, accurate to 15 digits after the decimal point.

4. Strings (String):


Single quotes:

The method that specifies a simple string is enclosed in single quotation marks. The single quotation mark also expresses a single quotation mark escaped with a backslash "\".

PHP does not parse the variables in single quotes, it is output directly.

Double quotes:

Variables can be parsed.

Delimiter: "<<<".

$a =<<<eot Here are character characters EOT; It is worth noting that this method end must be shelf written.

5. Arrays

Declaration method:

$arr = Array (1,2,3,4,5);//$arr = Array (k1 = 1, k2 = 2, K3 = 3);

6. Object:

7. Resources: Link or open an external resource.

8.NULL

Indicates that a variable has no value. Does not represent a space, does not represent 0, and does not represent an empty string.

$a =null; $b = "Me"; unset ($b); Var_dump ($a);//Direct assignment is null, Output nullvar_dump ($b);//output NULL, variable is destroyed var_dump ($c);//Output NULL, No statement at all.

The above three cases are judged null:

    • Assigns a variable directly to NULL.

    • The destroyed variable.

    • The declared variable is not assigned a value.


9. Pseudo-Class:

    • Mixed: Mixed type

    • Number: can be int or float

    • Callback: function as parameter


PHP Basics-Data types

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.