Empty () function Classic explanation

Source: Internet
Author: User

<?PHP/** * When Var does not exist, returns true; * Returns True if Var is present and is a non-null nonzero value (truth). * The following things are considered empty: * * 1. "" (empty string) * 2.0 (as an integer of 0) * 3.0.0 (as a floating-point number of 0) * 4. " 0 "(as a string of 0) * 5.NULL * 6.FALSE * 7.array () (an empty array) * 8. $var; (a variable that declares, but has no value)*/$a;$b=NULL;$c= 0;$d= ' ';$e= ' abc ';Echo Empty($a)." -a<br> ";Echo Empty($b)." -b<br> ";Echo Empty($c)." -c<br> "; Echo Empty($d)." -d<br> "; Echo Empty($e)." -e<br> ";//empty () is null, the variable e has a true value, return false, no outputEcho Empty($f)." -f<br> ";Echo NULL." -null<br> ";Echo false." -false<br> ";Echo true." -true<br> ";if(Empty($e)){    Echo"Variable e is not present or has no truth";}Else{    Echo"Variable e has a truth value and \ $e = ' {$e}‘;";}/** Output: 1-a1-b1-c1-d-e1-f-null-false1-true variable E has a true value, and $e = ' abc ';*/

Empty () function Classic explanation

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.