Before we get into learning about operators in PHP, we must first know what in general do we mean by an expression, operand and an operator. Below is the diagram that speaks out exactly what we need to know.
Going ahead, there are a total of 7 operators in PHP, namely –
1. Arithmetic operators – For operations like $a+b, $a-$b, etc.
2. Comparison operators – For operations like $a<$b, $c>5, etc.
3. Increment/Decrement operators – For operations like $a++, $b++, ++$c, etc.
4. Logical operators – For operations like ($a or $b), ($a || $b), ($a && $b), etc.
5. String operators – For operations like $a.$b for string concatenation, considering both $a and $b are some valid strings.
6. Assignment operators – For operations like $x = $y, $x = $x + $y, $x += $y, etc.
7. Array operators – We will learn about Arrays in PHP soon. However, considering $a and $b to be two different arrays, $a+$b would produce the union of two arrays, $a==$b would check if the two arrays have the same key value pairs, $a===$b would check the order of the key value pairs along with their values and so on.