Difference between three equal signs (=) and two equal signs (=) in PHP

Source: Internet
Author: User
Difference between "three equal signs" and "two equal signs" in PHP
Analyze the differences between the three equal signs ===and the two equal signs ===in php. For more information, see.

Recently, I want to study the specific differences between "=" and "=" in php. In fact, "=" is also used for comparison, but the comparison requirements are stricter. It is required that the types on both sides be compared;

For example:

$ A = 8; if ($ a = 8.0) or if ($ a = 8) both return TRUE; but if ($ a = 8.0) returns false. because the two types are different, true is returned only if ($ a = 8;

Assume that a function returns the following situations: 1. number greater than 0 2. number less than 0 3. number equal to 0 (that is, 0) 4. False (when a failure occurs). to capture a failure, use = instead of =. Why? Because = matches 4th cases and 3rd cases, because 0 is 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.