PHP Syntax Basics

Source: Internet
Author: User
PHP Data type (it is a weakly typed language)

Integer, floating-point, Boolean, String, array, object, NULL type, resource-type

Scalar type: integer, Float, Boolean, and String type! The so-called scalar types, in essence, can only store the type of individual information.

Compound: Array, object. The essence of composite types is that you can store multiple information!

Special type: null type and resource type


All types are stored in binary form in the computer!


Binary conversions:

Decimal conversion to binary: Multiply by 2 rounding method

Ten ext. Eight: Integer part in addition to eight remainder, fractional division by eight rounding

Octal is converted to binary and can be split three:

Binary conversion to octal can be three and one:

16 binary conversion to binary, you can split four:

Binary conversion to 16 binary can be four and one:

Eight ext. 16: First split three conversions to two, then four and one converted to 16:

16 ext. Eight: First split four converted to two, and then repeatedly and one converted to eight


Exponential form:

A few things to note:

1, E is case insensitive

2, there must be numbers before and after E.

E must be followed by an integral type


Integer data is stored in memory in the form of a second-order complement!

Positive number (symbol 0) of the original code, anti-code, the same complement

The inverse of a negative number (symbol 1) is on the basis of its original code, in addition to the symbol bit unchanged, the rest of the bitwise negation,

Complement of negative number = Its anti-code +1

Convert to Boolean, and a few will be converted to false:

Integral type 0:0

Floating point 0:0.0

String 0: ' 0 '

Empty string: ' "

NULL type: null

Empty array: Array ()


Resource type and object type are always true!


The difference between single and double quotes in PHP:

Single quote: Cannot recognize variable, escape character

Double quotes: Ability to recognize variables, escape characters

Delimiter:

Syntax:<<< start tag

Content

end tag;

The start tag and the end tag need to be consistent, and the tag is defined by itself. The end tag of the delimiter must be shelf written!


Type-dependent functions:

GetType () Gets the data item type

Settype () Sets the type of the variable

Isset () Determine if a variable exists

Empty () to determine if the variable is null

  • 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.