Apps referenced in php & lt ;? Phpblog. csdn. netsamxx8articledetails37564103 ** in PHP, it means that different names access the same variable content. (1) References between variables: $ a10; $ B $ a; $ B and $ a point to the same storage address, if $ a11; the application referenced in zend php
'; $ A = conFuncTest (); // This statement will output the value of $ B as 1 $ a = 5; $ a = conFuncTest (); // This statement outputs the value of $ B as 2 $ a = & conFuncTest (); // This statement outputs the value of $ B as 3 // at this time, it is equivalent to $ a = & $ B; $ a = 5; // at this time, $ B is $ a's alias $ B = 5; $ a = conFuncTest (); // This statement will output the value of $ B as 6 // (4) object reference, the object reference is also to save space class object {public $ value = 'Hello World'; // If you want to clone, do not clone public function _ clone () {$ this-> value = 'not clone '; }}$ oBject_a = new object; $ oBject_ B = $ oBject_a; // The above is equivalent to $ oBject_ B = & $ oBject_a; echo $ oBject_a-> value; // Here, ABC is output. // modifying the value of object a will affect the value of B, because $ B is a reference of $ a $ oBject_a-> value = 'not hello'; echo $ oBject_ B-> value; // output not hello // If you do not want to affect the value of object a, use the magic method _ clone $ obj2 = clone $ oBject_a; echo $ obj2-> value; // (5) destroy the variable $ a = 11; $ B = & $ a; unset ($ a); // at this time $ B = 11; // equivalent to function quoteTest () {global $ var; // equivalent to $ var = & $ GLOBALS ['var']; unset ($ var); // deletion only deletes the reference, and the referenced content still exists, same as above, this does not mean that the variable content has been destroyed} $ var = 1; quoteTest (); echo $ var; // echo $ wlt = 111; print_r ($ GLOBALS ); unset ($ wlt); print_r ($ GLOBALS );