Comparison Operators
Comparisons are used to check the relationship between variables and/or values. If you would like to see
a simple example of a comparison operator in action, check out our If Statement Lesson. Comparison operators are used inside conditional statements and evaluate to either true or false. Here are the most important comparison operators of PHP.
Assume: $x = 4 and $y = 5;
Operator | English | Example | Result |
== | Equal To | $x == $y | false |
!= | Not Equal To | $x != $y | true |
< | Less Than | $x < $y | true |
> | Greater Than | $x > $y | false |
<= | Less Than and Equal To | $x <= $y | true |
>= | Greater Than and Equal To | $x >= $y | false |
0 comments:
Post a Comment