Search code examples
phpassignment-operator

PHP's =& operator


Are both these PHP statements doing the same thing?:

$o =& $thing;

$o = &$thing;

Solution

  • Yes, they are both the exact same thing. They just take the reference of the object and reference it within the variable $o. Please note, thing should be variables.