Tutorial for Comparison operators

What is Comparison operators?

The comparison operator denotes the connection between two or more values in a number or a series. These php operators are simply used to compare the two values’ integers or strings. We’ll show you how to compare them using php operators in this article. This PHP operator is necessary for looking for discrepancies or correlations between values and variables. It behaves like a boolean, yielding either True or False. For example, if the two variables you’re comparing don’t have the same value, the PHP not equal to operator will return true.

  • Operator Name Example Result
  • == Equal $x == $y Returns true if $x is equal to $y
  • === Identical $x === $y Returns true if $x is equal to $y, and they are of the same type
  • != Not equal $x != $y Returns true if $x is not equal to $y
  • <> Not equal $x <> $y Returns true if $x is not equal to $y
  • !== Not identical $x !== $y Returns true if $x is not equal to $y, or they are not of the same type
  • > Greater than $x > $y Returns true if $x is greater than $y
  • < Less than $x < $y Returns true if $x is less than $y
  • >= Greater than or equal to $x >= $y Returns true if $x is greater than or equal to $y
  • <= Less than or equal to $x <= $y Returns true if $x is less than or equal to $y



Ashwani Kumar
Latest posts by Ashwani Kumar (see all)
Tagged : / / / / / / /
0 0 votes
Article Rating
Notify of

Inline Feedbacks
View all comments
Would love your thoughts, please comment.x