Operators are used to calculate values using PHP.
Think of all the different operators as different buttons on a calculator. Each button calculates a value differently, and each PHP operator calculates a value differently.
If you remember simple algebra, many of these operators will look familiar to you, such as greater than (>) and less than (<). However, there are many other operators that can be used with PHP, which can be divided into four groups: Arithmetic, Assignment, Comparison and Logical operators.
Modulus (the remainder value of after a division)
Increment (increase by a specific number)
Decrement (decrease by a specific number)
$i++ (the value of the string $i would increase by 1)
$i– (the value of the string $i would decrease by 1)
Assignment operators are not used as regularly as arithmetic or comparison operators, but they are still good to know.
x=y is the same as x=y
x+=y is the same as x=x+y
x-=y is the same as x=x-y
x*=y is the same is x=x*y
x/=y is the same as x=x/y
x.=y is the same as x=x.y
x%=y is the same as x=x%y
Is Equal To
Is Not Equal To
Is Less Than
Is Greater Than
Is Less Than or Equal To
Is Greater Than or Equal To
8 == 8
1 != 2
2 < 8 8 > 2
4 <= 7 7 >= 7
The concentration operator is used to join multiple strings together by using a period (.).
For an example of how to use the concentration operator, see PHP strings.