What do the '&=' and '=&' operators do?

前端 未结 4 1438
抹茶落季
抹茶落季 2021-01-03 23:24

Finding the answer to this is turning out to be much more difficult than I would have thought. Since I don\'t have a clue what you\'d call this, it\'s hard to run a Google s

4条回答
  •  没有蜡笔的小新
    2021-01-03 23:50

    '&=' and '=&' are very different operators.

    '&=' is a bitwise assignment operator:

    $var = false;
    $var &= foo(); // will call foo()
    $var = false & foo(); // will call foo()
    $var = $var && foo(); // will not call foo()
    

    '=&' returns a reference:

    $a = $b; //$a points to $b
    $a =& $b; //$a does NOT point to $b... both point to the same thing.
    

提交回复
热议问题