|
|
| Php Operators |
Using Operators
Operators perform operations on variables and values
Assignment Operators
Result:
$my_var = 2;
$another_var = $my_var;
Both vars now contain the value of 4
Arithmetic Operators
Result:
Perform addition: 1 + 9 = 10 Perform subtraction: 5 - 1 = 4 Perform multiplication: 2 * 5 = 10 Perform division: 15 / 3 = 5 Perform modulus: 5 % 2 = 1
Comparison Operators
Comparisons are used to check the relationship between variables and values
| Operator | English | Example | Result |
| == | Equal To | $x == $y | false |
| != | Not Equal To | $x != $y | true |
| < | Less Than | $x < $y | true |
| > | Greater Than | $x > $y | false |
| <= | Less Than or Equal To | $x <= $y | true |
| >= | Greater Than or Equal To | $x >= $y | false |
|
|