Operators


Assignment Operators

Assignment operator assigns right value or result of expression to the left.

Operator Sign Syntax Additional Information
assignment = $var = 1 assign 1 to $var
addition += $var += 1 assign result of $var + 1 to $var
subtraction -= $var -= 1 assign result of $var - 1 to $var
multiplication *= $var *= 2 assign result of $var * 2 to $var
division /= $var /= 2 assign result of $var / 2 to $var
the rest %= $var %= 2 assign result of $var % 2 to $var
concatenate .= $var .= "string" assign result of $var . "string" to $var
bitwise AND &= $var &= 0x02 assign result of $var & 0x02 to $var
bitwise OR |= $var |= 0x02 assign result of $var | 0x02 to $var
bitwise XOR ^= $var ^= 0x02 assign result of $var ^ 0x02 to $var
left shift <<= $var <<= 4 assign result of $var << 4 to $var
right shift >>= $var >>= 4 assign result of $var >> 4 to $var