01PHP reference assignment and pass assignment

Source: Internet
Author: User

The reference assignment of variables in PHP is carried out through the & symbol, where we introduce the role of the  1 & symbol Introduction. First introduction to the delivery assignment <?php     $a =1;    $b = 3;                         from memory point of view: $a point to an address, the corresponding data is 1   $b point An address, the corresponding data is 3      $a = $b;                         Now execute $a= $b is to assign a value in $b to $ A then $a =3  & nbsp echo $a, $b,//3  3               So the value of two variables is 3 3 >2. Reference Assignment <?php    $a =1;    $b =2;    $a =& $b;               This is now done by assigning the address of B to $ A $a a reference to the same two variables as the address of $b to the same memory space   data is 2     echo $a $b//2 2                            and nbsp                          ,         &NB Sp                     unset ($b);        variable has a mechanism if there are multiple variables pointing to the same address canceling one of the variables other variables are not affectedecho $a;//2 >

01PHP reference assignment and pass assignment

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.