More Mathematical Operators
-
Increment and decrement works the same way as JavaScript.
-
What are the results of the following operations?
$number = 0;
$value = 0;
$value = ++$number;
$value = $number++;
$value = --$number;
$value = number--;
-
You can also use the shortcut:
+=, -=, *=, /=, %=, **=, .=
-
So, the shortcut for adding 2 to $number is:
$number += 2;
-
And, the shortcut for multiplying $number and $value and putting the result
in $number is:
$number *= $value;
String Operators
Home