How does PHP determine if 0.0/0.00/0.000 is empty? Test the empty function.

Source: Internet
Author: User
if $number = =0     )echo ' empty '; if Floatval ($number) = = 0    )echo ' empty '

First, PHP thinks that 0.0 is empty, so 0.00 and 0.000 will also be considered null as 0.0, so empty will return true to express PHP's rules.
However, in the world of PHP, ' 0.0 ', ' 0.00 ', and ' 0.000 ' are not considered null, so empty will return false.
Thus, the landlord said the "elegant judgment 0.0/0.00/0.000 is empty" refers to what kind of situation? How can the empty function be incompetent?
(add: The empty function only accepts variables)

How does PHP determine if 0.0/0.00/0.000 is empty? Test the empty function.

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.