Comparison¶
Comparison operators, as their name implies, allow you to compare two values.
PHP comparisons exists with type-juggling, ==, <>, <=>, switch() and !=, and with type checks, match(), === and !==.
Inequalities only exist with type-juggling.
There are also functions dedicated to comparisons, with specific applications : strcmp(), strcasecmp(), strnatcasecpm(), strcoll(), similar_text(), levensthein(), bccomp(), version_compare(), hash_equals().
<?php
if ($a == $b) {
print "a and b are equal";
}
?>
See also PHP Variable Comparison, https://www.educative.io/answers/difference-between-the-and-operators-in-php
Related : Operators, Type Juggling, Switch, Match, Spaceship Operator