Arithmetic Operators: What Is Operator? Simple Answer Can Be Given Using Expression 4 + 5 Is Equal To 9. Here 4 and
Arithmetic Operators: What Is Operator? Simple Answer Can Be Given Using Expression 4 + 5 Is Equal To 9. Here 4 and
Here 4 and
5 are called operands and + is called operator. PHP language supports following type of
operators.
Arithmetic Operators
Comparison Operators
Logical (or Relational) Operators
Assignment Operators
Conditional (or ternary) Operators
Arithmetic Operators
There are following arithmetic operators supported by PHP language −
Show Examples
Comparison Operators
There are following comparison operators supported by PHP language
Show Examples
Logical Operators
There are following logical operators supported by PHP language
Show Examples
Assignment Operators
There are following assignment operators supported by PHP language −
Show Examples
Conditional Operator
There is one more operator called conditional operator. This first evaluates an expression for a
true or false value and then execute one of the two given statements depending upon the result of
the evaluation. The conditional operator has this syntax −
Show Examples
Operators Categories
All the operators we have discussed above can be categorised into following categories −
For example x = 7 + 3 * 2; Here x is assigned 13, not 20 because operator * has higher
precedence than + so it first get multiplied with 3*2 and then adds into 7.
Here operators with the highest precedence appear at the top of the table, those with the lowest
appear at the bottom. Within an expression, higher precedence operators will be evaluated first.