Clear analysis of phpunset () and null variables

Source: Internet
Author: User
Unset (mixedvar [, mixedvar [,...]) unset () destroys the specified variable. Note that in php3, unset () will return true (actually an integer value of 1), while... unset (mixed var [, mixed var [,...]).

Unset () destroys the specified variable. Note that in php 3, unset () will return true (actually an integer value of 1). in php 4, unset () is no longer a real function: it is now a statement, so that no return value is returned. an attempt to obtain the return value of unset () will cause a parsing error.

Null bytes indicate that the variable is null $ t = ''. the variable has a value, but is null. the isset () parameter is true.

The null constant is $ t = null. the variable has no value, and is not empty. the isset () is false.

 'A', 'B' => 'B'); $ B = array ('a' => 'A', 'B' => 'B '); $ a ['B'] = null; unset ($ B ['B']); print ('
'); Print_r ($ a); print ('
'); Print_r ($ B); print ('
');/* Result: array ([a] => a [B] =>) array ([a] => a) */?>


Reprinted at will, but please attach the article address :-)

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: 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.