Why is the $ GLOBAL [''] and keyword global affected by static variables in php?

Source: Internet
Author: User
Php Chinese network (www.php.cn) provides the most comprehensive basic tutorial on programming technology, introducing HTML, CSS, Javascript, Python, Java, Ruby, C, PHP, basic knowledge of MySQL and other programming languages. At the same time, this site also provides a large number of online instances, through which you can better learn programming... Reply content: the first time this problem occurs. A little curious. How did the subject discover this problem?

Let me explain my understanding.

First, we need to clarify" Assignment.

When $ a = 1;, it does not mean to add data whose name is $ a and whose value is 1.
When $ B = & $ a;, it doesn't mean to point $ B to $ a or vice versa.

The image of this process is as follows:

$a = 1;
Read more php manuals, many examples
PHP: variable range
PHP: References
PHP: reference transfer
PHP: Reference



Variable range

The scope of a variable is the context defined by it (that is, its effective range ). Most PHP variables have only one separate range. This separate range span also contains the files introduced by include and require. For example:



   

Global $ a; a new pointer pointing to the same address as external $ a $ GLOBALS ['A'] = & $ static_a; will point the external $ a pointer to the content of $ static_a, discard the original pointing

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.