Operators are mathematical, string, comparison, and logical commands such as plus, minus, multiply, and divide.PHP looks a lot like plain arithmetic; for instance, the following statement output:8
Arithmetic operators do what you would expect. They are used to perform mathematics. You can use them for the main four operations (plus, minus, times, and divide) as well as to find a modulus and to increment or decrement.
These operators are used to assign values to variables. They start with a very simple = and move on to +=,-= and so on. The operators += adds the value on the right side to the variable on the left, instead of totally replacing the value on the left.thus,if $count start with the value 5,the statement
$count += 1;
Comparison operators are generally used inside a construct such as an if statement in which you need to compare two items. For example, you may wish to know whether a variable you have been incrementing has reached a specific value, or whether another variable is less than a set value
If you have used them used before, “If the time is later than 12 p.m and earlier than 2 p.m, then have lunch”.In PHP, the code for this might look something like the following:
if($hour >12 && $hour<14) dolunch();
Relational operators test two operands and return a Boolean result of either TRUE or FALSE. There are three types of relational operators: equality, comparison, and logical.