PHP equals and operators

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 what 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
链接地址: http://www.djcxy.com/p/57588.html

上一篇: “=&”用法的真实例子

下一篇: PHP等于和运营商