The variables in PHP and the case in PHP that are counted as false

Source: Internet
Author: User

A variable in PHP

Variables in 1.PHP, declaration and use must start with $
2.PHP is a weakly typed language, and variables do not actually need to be declared. You can assign any type of value directly to a variable;
You can declare multiple variables at the same time using a hyphen in 3.PHP.
Eg:num1=num2=num3 and cannot be separated with commas
4. Common variable functions:
unset (): Delete and release variables
Isset (): Detects if the variable is set
Empty (): detects if the variable is empty (not set or null is empty)
5. The name of the variable: only alphanumeric underscores can be made, starting with numbers. And the variables in PHP are case-sensitive, $Name $name are different
However, PHP built-in functions or class names are case-insensitive! Eco Echo is effective!
Data types in 6.PHP (8 kinds)
4 Standard Types: Boolean boolean shaping integer floating-point float/double string
2 composite types: Arrays Array Objects Object
2 Special types: resource resource null
7. The scope of the Shaping: -2^31~ (2^31-1), over this range, automatically to floating-point type.

Two cases of false in PHP

1.Boolean false
2. Shaping 0
3. Float type 0.0
4. String "" "0" ("0.0" "000" are all pairs)
5. Empty array
6. Empty objects are counted as false only in PHP4. Other version objects are counted true
7.null the undefined variable on the monk
8. All resources are right, (except PHP4, all objects are counted)

The variables in PHP and the case in PHP that are counted as false

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.