Cancel and locate php reference

Source: Internet
Author: User
Interpretation of PHP-based references-Cancelling and locating references

Cancel reference

When unset is a reference, it only disconnects the binding between the variable name and the variable content. This does not mean that the variable content is destroyed. For example:

 

Not unset $ B, just $.

It may be helpful to understand this analogy with the Unix unlink call.

Reference and positioning

Many PHP syntax structures are implemented through the reference mechanism, so all the above-mentioned reference binding applies to these structures. Some structures, such as reference transfer and return, have been mentioned above. Other referenced structures include:

Global Reference

When a variable is declared with global $ var, a reference to the global variable is actually created. That is to say, it is the same as doing so:

 

This means that, for example, unset $ var does not unset global variables.

$ This

In the method of an object, $ this is always a reference to the object that calls it.

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.