Reputation: 9183
I have a question regarding the different usage of & in the following two examples:
$x = &$b; // which I know what it does
But what about this one:
$x &= get_instance();
Upvotes: 0
Views: 43
Reputation: 3762
&= is the "bitwise and"-assignment operator. In PHP
$a &= $b;
is the same as
$a = $a & $b;
"bitwise and" means that two corresponding bits of two arguments are evaluated using the and-operator. If the arguments are not integers, they are converted to integer values first. For details you can refer to the php manual.
Upvotes: 1