PHP equals and operators [duplicate]
Possible Duplicates:
Reference - What does this symbol mean in PHP? what do “=&” / “&=” operators in php mean?
Sorry guys I feel like I'm asking too simple of a question but 开发者_如何学Pythonwhat is =& in PHP? I tried to use this group function with ACL in Cakephp...
You use =&
when you want to assign a variable by reference. For more information see http://php.net/manual/en/language.references.php.
Example:
$a = array(1, 2, 3);
// $b is a reference to $a.
// If you change $a or $b, the value for both $a and $b will be changed.
$b =& $a;
$c = array(1, 2, 3);
// $d is a copy of $c.
// If you change $d, $c remains unchanged.
$d = $c;
$b = 3;
$a =& $b;
$b = 5; //$a is 5 now
$a = 7; //$b is 7 now
精彩评论