Solution to empty and isset-PHP variable definition judgment

Source: Internet
Author: User
Solution to empty and isset-does PHP variable define a warning when accessing an undefined variable? Before use, you can use empty (); or isset () to determine whether the variable defines $ arr ['k1 ']. although $ arr is undefined, we can still use these two functions to solve empty and isset-determine whether PHP variables are defined.

PHP generates a warning when accessing an undefined variable.

?

You can use empty (); or isset () to determine whether a variable is defined.

$ Arr ['k1 ']; although $ arr is undefined, you can use these two functions to determine

If we use if to judge, what will happen? Undefined variable warning

?

The definition of a variable is different from that of setting the variable to null. When unset () is used, the variable is set to undefined.

?

No return or return in the function; call this function and the result 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.