views:

334

answers:

2

I am having a hard time determining what the =& (equals-ampersand) assignment operator does in PHP. Can anyone explain it? Is it deprecated? Thanks!

+7  A: 

It's 2 different operators. = is assignment as you probably know. and & means the variable should be accessed by reference rather than by value.

Asaph
I'm sorry but this is way too simplistic. $a = will also result in $b having a 5. However the reference link may be broken by $b = or unset($b); At which time $a will be the only variable that knows where the cell is that holds the 5. Also beware that if you set $a using = will not break the link, it only replaces the 5 with null;
Don
@Don: Thanks for the elaboration. I can tell you're a C programmer.
Asaph
I second what Don says. But I wouldn't say this is way too simplistic. I'd say this is wrong.
Artefacto
+2  A: 

It's a variable reference, as described here.

Kaleb Brasee