Applications quoted in PHP

Source: Internet
Author: User
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);

  • 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.