Applications referenced in PHP
'; $a =confunctest ();//This statement outputs a value of $b of 1 $a = 5; $a =confunctest ();//This statement will output $b value of 2$a=&confunctest ();//This statement will output $b value of 3//At this time equivalent to $ A = & $b; $a =5;//at this time $b is the alias of $ A $b = 5; $a =confunctest ();//This statement outputs a reference to the 6//(4) object, and the object's reference is also to save space class object{public $value = ' Hello world ';//If you want clone, do not let the 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 output ABC//modifies the value of object A, which affects the value of B because $b is a $ A reference $oBject _a->value = ' not hello '; Echo $oBject _b-> value;//output not hello//here if you do not want to affect the value of object A, you can use the Magic method __clone$obj2 = Clone $oBject _a; Echo $obj 2->value;//(5) variable destruction $a = 11; $b =& $a; unset ($a); At this time $b = 11; Equivalent to function quotetest () {Global $var; Equivalent to $var = & $GLOBALS [' var ']; Unset ($var); Delete just deletes the reference, and the referenced content still exists, as above this does not mean that the contents of the variable was destroyed} $var = 1; Quotetest (); Echo $var; echo $WLT = 111; Print_r ($GLOBALS); Unset ($WLT); Print_r ($GLOBALS);