Well, this one is hard to find on Google, so I’m putting it in WhyPad to make it easy to find…at least for me, and I guess for you too since you here. Welcome! You may see PHP code snippets (PHP 5+ only) that have an ampersand, ‘&’, preceding a variable like &$my_variable. So, what does it do? It sets up a reference to the original variable instead of copying it’s value. The following snippet demonstrates:
$original = "foo"; $ref = &$original; echo $ref; \\Prints "foo"....Note that you don't continue to use the '&' after the var is initialized now change $original $original = "bar"; echo $ref; \\Now prints: "bar"
$ref would be unaffected by changes to $original if it had been set using the normal: $ref = $original;
Next to figure out what that @ is doing in PHP code… 😉
[UPDATE] David sheds light on the “@” below…Thanks David!