Use of PHP Comparison Operators is comparing two values (number or string).
| Operator | Description |
|---|---|
| == | Is equal to |
| === | Identical |
| != | Is not equal to |
| <> | Is not equal to |
| !== | Is Identical |
| > | Greater than |
| < | Less than |
| >= | Greater than or equal to |
| <= | Less than or equal to |
Example:
<?php
$a = 20;
$b = 30;
if ($a == $b) {
echo "a and b is equal";
} else {
echo "a is not equal to b";
}
?>