pass by reference - What is the difference between "&=" and "=&" when assigning a variable value in PHP? -


i know =& means "assign reference", happens if reverse these 2 characters, since i've seen in plenty of php scripts?

&= compound assignment operator, whereas =& 2 separate operators (= , &), pushed together. legal syntax because php doesn't demand whitespace between them.

&= performs bitwise , operation between left hand side , right hand side, assigns result left hand side variable.

$x = 1; $x &= 0; // $x === 0 now. more verbose syntax "$x = $x & 0;" 

on other hand =& should expanded = & operators seperate. known assignment reference. = standard assignment operator, , & when prefixed before variable name returns reference variable.

$y = "foobar"; $x = &$y; // $x holds reference $y. 

Comments

Popular posts from this blog

Why does Ruby on Rails generate add a blank line to the end of a file? -

keyboard - Smiles and long press feature in Android -

node.js - Bad Request - node js ajax post -