Operator Types - PHP
Operator:
The Operator is a expression like as we can say 5+7 equal to 12. So Here we will say 5 and 7 operands and + is a operator.
Advance PHP Language follow different types of Operators. These are following...
- Comparison Operators
- Arithmetic Operators
- Logical (Relational) Operators
- Assignment Operators
- Conditional (Ternary) Operators
Here we will discuss all in detail one by one.
- Comparison Operators
We discuss some of comparison operators follow by PHP language
Assume variable One holds 5 and variable Two holds 8 then......
Examples of Comparison operators are.....
Operator Description Example
- " == " (it will Checks when the value of two operands equal or not equal, if yes then condition becomes true.) (A == B) is not true.
- " != " (it will Checks when the value of two operands equal or not equal, if the values not equal, that's condition becomes true.) (A != B) is true.
- " > " (it will Checks When left operand value is greater than right operand value, if it will yes then condition will true.) (A > B) is not true.
- " < " (it will Checks When left operand value is less than right operand value, if it will yes then condition will true.) (A < B) is true.
- " >= " (it will Checks when the value of left operand is greater than or equal to the value of right operand, if yes then condition becomes true.) (A >= B) is not true.
- " <= " (it will Checks if the value of left operand is less than or equal to the value of right operand, if yes then condition becomes true.) (A <= B) is true.
Comparison operator |
2:Arithmetic Operators
We will discuss following arithmetic operators that link by PHP language −
Assume variable One holds 3 and variable Two holds 5 then....
Example of Arithmetic Operators are...
- " + " (It will Adds two different operands) A + B will give 8
- " - " (Ir will Subtracts 2nd operand from the 1st) A - B will give -2
- " * " (It will Multiply both different operands) A * B will give 15
- " / " (Divide numerator by de-numerator) B / A will give 1.66
- " % " (Modulus Operator and remainder of after an integer division) B % A will give 0
- " ++ " (This Operator is Increment operator, increases integer value by one) A++ will give 4
- " -- " (This Operator is Decrement operator, decreases integer value by one) A-- will give 2
Arithmetic Operator |
Remaining Other Types we Will Discuss Next Lesson.
Comments
Post a Comment