Search code examples
phpcode-readability

where to put & in php?


i wonder where i should put the & properly.

$b =& $a;
or
$b = &$a;

Solution

  • Both reference the same thing, just a matter of coding style.

    Personally, I prefer the $b = &$a style for readability, the space from the & and $ throws me off.