There doesn't seem to be a logical assignment operator in PHP. I would like to be able to write $a = $a || $b
as $a ||= $b
.
Note that this is not the same as $a |= $b
, which does not short-circuit when $a
evaluates to true
.
Is there such functionality in PHP?