Application referenced in php. Application referenced in php; $ aconFuncTest (); this statement will output the value of $ B as 1 $ a5; $ aconFuncTest (); this statement outputs the value of $ B as 2 $ aconFuncTest (). This statement outputs the application referenced in 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 );
The application referenced in the http://www.bkjia.com/PHPjc/962646.htmlwww.bkjia.comtruehttp://www.bkjia.com/PHPjc/962646.htmlTechArticlephp; $ a = conFuncTest (); // This statement outputs the value of $ B as 1 $ a = 5; $ a = conFuncTest (); // This statement will output the value of $ B as 2 $ a = conFuncTest (); // This statement will output...