PHP OPERATORS
operators are symbols or special keywords that perform operations on variables or values.
the operators in the following groups:
- Arithmetic Operators
- Assignment Operators
- Comparison Operators
- Logical Operators
- Increment/Decrement Operators
- Concatenation Operator
- Ternary Operator
- Null Coalescing Operator
- Type Operators
- Bitwise Operators
+ Addition
- Subtraction
* Multiplication
/ Division
% Modulus, remainder of division
Assignment Operators:
= Assignment
+= Add and assign
-= Subtract and assign
*= Multiply and assign
/= Divide and assign
%= Modulus and assign
Comparison Operators:
== Equal to
!= Not equal to
< Less than
> Greater than
<= Less than or equal to
>= Greater than or equal to
Logical Operators:
&& or and Logical AND
|| or or Logical OR
! or not Logical NOT
Increment/Decrement Operators:
++ Increment by 1
-- Decrement by 1
Concatenation Operatstrings
. Concatenates strings
Ternary Operator:
condition ? true_expression : false_expression (Conditional expression)
Null Coalescing Operator:
?? Returns the left operand if it's not null, otherwise returns the right operand
Type Operators:
instanceof (Checks if an object is an instance of a class)
Bitwise Operators:
& Bitwise AND
| Bitwise OR
^ Bitwise XOR
~ Bitwise NOT
<< Bitwise left shift
>> Bitwise right shift