Home >Backend Development >PHP Tutorial >Which is the comparison operator in php?
Comparison operators in PHP are used to compare the equality or size relationship of values, including: equal to (==) not equal to (!=) greater than (>) less than (<) greater than or equal to ( >=) Less than or equal to (<=) Constantly equal to (===) Not equal to (!==)
PHP Comparison operators
Comparison operators are used to compare whether two values are equal or have a size relationship. In PHP, comparison operators include:
1. Equal (==)
Compares two values for equality, regardless of data type.
2. Not equal to (!=)
Compares whether two values are not equal, regardless of data type.
3. Greater than (>)
Compares two values and returns true if the value on the left is greater than the value on the right.
4. Less than (<)
Compares two values and returns true if the value on the left is smaller than the value on the right.
5. Greater than or equal to (>=)
Compares two values and returns true if the value on the left is greater than or equal to the value on the right.
6. Less than or equal to (<=)
Compares two values and returns true if the value on the left is smaller or equal to the value on the right.
7. Identity (===)
Compares whether two values are completely equal, including data type and value.
8. Not equal to (!==)
Compares whether two values are not completely equal, including data type and value.
The above is the detailed content of Which is the comparison operator in php?. For more information, please follow other related articles on the PHP Chinese website!