Home > Article > Backend Development > What is the difference between php <> and !=?
php What is the difference between <> and !=? The following article will introduce it to you. It has certain reference value. Friends in need can refer to it. I hope it will be helpful to everyone.
##The difference between php <> and !=
<> and
!= are all judged to be unequal.
<>, and later upgraded to
!=. There is basically no difference between the two, it depends on personal coding habits.
<> has the same effect as
!=, there is no difference; however, it is recommended to use
!=, which is more readable high.
Extension:
PHP comparison operatorPHP comparison operator is used to compare two values (numbers or strings):
Name | Example | Result | |
---|---|---|---|
Equals | $x == $y | Returns true if $x is equal to $y. | |
Congruent (identical) | $x === $y | If $x is equal to $y, and they are of the same type, return true. | |
!= | is not equal to | $x != $y | Returns true if $x is not equal to $y. |
is not equal to | $x <> $y | Returns true if $x is not equal to $y. | |
Not congruent (completely different) | $x !== $y | if Returns true if $x is not equal to $y, or they are not of the same type. | |
is greater than | $x > $y | Returns true if $x is greater than $y. | |
is less than | $x < $y | Returns true if $x is less than $y. | |
Greater than or equal to | $x >= $y | If $x is greater than or equal to $ y, then return true. | |
is less than or equal to | $x <= $y | if Returns true if $x is less than or equal to $y. |
The above is the detailed content of What is the difference between php <> and !=?. For more information, please follow other related articles on the PHP Chinese website!