Операторы


Операторы сравнения

Результат операторов сравнения всегда логического типа.

Оператор Знак Синтаксис Дополнительная информация
Equal
(value)
== $var1 == $var2 TRUE if $var1 is equal to $var2
Identical
(value+type)
=== $var1 === $var2 TRUE if $var1 is equal to $var2
and they are of the same type
Not equal
(value)
!= $var1 != $var2 TRUE if $var1 is not equal to $var2
Not identical
(value+type)
!== $var1 !== $var2 TRUE if $var1 is not equal to $var2
or they are not of the same type
Not equal
(value)
<> $var1 <> $var2 TRUE if $var1 is not equal to $var2
Less than < $var1 < $var2 TRUE if $var1 is strictly less than $var2
Greater than > $var1 > $var2 TRUE if $var1 is strictly greater
than $var2
Less than
or equal to
<= $var1 <= $var2 TRUE if $var1 is strictly less
than or equal to $var2
Greater than
or equal to
>= $var1 >= $var2 TRUE if $var1 is strictly greater
than or equal to $var2