Home >Backend Development >PHP Tutorial >What are the comparison operators in php?
PHP provides a wide range of comparison operators for checking whether two values are equal: ==: Values and types are equal!=: Values are not equal===: Values and types are equal!==: Values or types are not equal<: left operand is less than right operand<=: left operand is less than or equal to right operand: left operand is greater than right operand=: left operand is greater than or equal to right operand
PHP Comparison Operators
PHP provides a series of comparison operators for comparing whether two values are equal. These operators are essential for evaluating and processing expressions.
Operator list:
Operator | Description |
---|---|
== | Check whether two values are equal (value and type are equal) |
!= | Check both Whether the values are not equal |
=== | Check whether the two values are strictly equal (the value and type must be the same) |
!== | Check whether two values are strictly not equal |
< | Check whether the left operand is less than the right operand |
<= | Check whether the left operand is less than or equal to the right operand |
> | Check whether the left operand is greater than the right operand |
Check whether the left operand is greater than or equal to the right operand |