What are operators? Things you can execute operations with. PHP has different kinds of operators:

## Arithmetic operators

For Mathematical operations. Choose of the following:

- + Addition
- – Subtraction: Subtracts a value from a variable
- * Multiplies
- / Divides
- % Modulus: Gives the remaining number when using division
- ++ Increments
- – – Decrements

Note: The increment/decrement operators only affect numbers and strings. Arrays, objects and resources are not affected. Decrementingvalues has no effect too, but incrementing them results in`NULL`

1.

– by php.net

## Assignment Operators

Assigning Values to Variables.

- = Variable equals number
- += Adds value to variables (not replaces variable)
- -= Decrease value from variable
- *= Multiplies value to variable
- /= Divides value from variable
- .= used in strings to concatenate: $j.=$k is equivalent to $j . $k
- %= Modulus

## Comparison Operators

Often used in if statements when comparing 2 items

- == is equal to //
**NOTE:**Don’t mix up with assignment operator = - != is not equal to
- > greater than
- < less than
- >= greater than or equal to
- <= less than or equal to

## Logical Operators

Usually it is used to combine the results of other operators and returns true or false.

- && and
- and Low-precedence and
- || or
- or Low-precedence or
- ! not
- xor Exclusive or

Advertisements