PHP Operators
PHP Operators
PHP Operators
Operators are used to perform operations on variables and values.
Arithmetic operators
Assignment operators
Comparison operators
Increment/Decrement operators
Logical operators
String operators
Array operators
Conditional assignment operators
The basic assignment operator in PHP is "=". It means that the left operand
gets set to the value of the assignment expression on the right.
x=y x=y The left operand gets set to the value of the Try it »
expression on the right
=== Identical $x === Returns true if $x is equal to $y, and they are of Try it
$y the same type »
!== Not identical $x !== Returns true if $x is not equal to $y, or they are Try it
$y not of the same type »
>= Greater than $x >= $y Returns true if $x is greater than or equal to $y Try it
or equal to »
<= Less than or $x <= $y Returns true if $x is less than or equal to $y Try it
equal to »
<=> Spaceship $x <=> Returns an integer less than, equal to, or greater Try it
$y than zero, depending on if $x is less than, equal »
to, or greater than $y. Introduced in PHP 7.
PHP Increment / Decrement Operators
The PHP increment operators are used to increment a variable's value.
=== Identity $x === Returns true if $x and $y have the same key/value Try it
$y pairs in the same order and of the same types »