PHP manual states that:
Adding 3 to the current value of $a can be written '$a += 3'. This means exactly "take the value of $a, add 3 to it, and assign it back into $a". In addition to being shorter and clearer, this also results in faster execution.
I used to think that $a += 3
is merely syntax sugar for $a = $a + 3
and thus they should be equal in all respects.
Why does $a += 3
result in faster execution compared to $a = $a + 3
?