PHP operators
PHP operators
1] Arithmetic Operators:
- Addition (+)
- Subtraction (-)
- Multiplication (*)
- Division (/)
- Modulus (%)
- Exponentiation (**)
2] Assignment Operators:
- Assignment (=)
- Addition assignment (+=)
- Subtraction assignment (-=)
- Multiplication assignment (*=)
- Division assignment (/=)
- Modulus assignment (%=)
3] Comparison Operators:
- Equal (==)
- Identical (===)
- Not equal (!= or <>)
- Not identical (!==)
- Greater than (>)
- Less than (<)
- Greater than or equal to (>=)
- Less than or equal to (<=)
4] Logical Operators:
- AND (&& or and)
- OR (|| or or)
- NOT (! or not)
- XOR (exclusive OR) (xor)
5] Increment/Decrement Operators:
- Increment (++)
- Decrement (--)
6] String Operators:
- Concatenation (.)
- Concatenation assignment (.=)
7] Array Operators:
- Union (+)
- Equality (==)
- Identity (===)
- Inequality (!= or <>)
- Not identical (!==)
8] Ternary Operator:
- Syntax :-
- (condition) ? expression1 : expression2;
it works:
- 1] If the condition evaluates to true, the expression1 is executed.
- 2] If the condition evaluates to false, the expression2 is executed.
Related Post :-
No comments:
Post a Comment