Comparison Operators

No Comments

PHP comparison operators allows you to compare two values with each other.

Below is a table of all the different comparison operators that are available for PHP

Comparison Operators
ExampleNameResult
$a == $bEqualTRUE if $a is equal to $b.
$a === $bIdenticalTRUE if $a is equal to $b, and they are of the same type. (introduced in PHP 4)
$a != $bNot equalTRUE if $a is not equal to $b.
$a <> $bNot equalTRUE if $a is not equal to $b.
$a !== $bNot identicalTRUE if $a is not equal to $b, or they are not of the same type. (introduced in PHP 4)
$a < $bLess thanTRUE if $a is strictly less than $b.
$a > $bGreater thanTRUE if $a is strictly greater than $b.
$a <= $bLess than or equal toTRUE if $a is less than or equal to $b.
$a >= $bGreater than or equal toTRUE if $a is greater than or equal to $b.
Last Updated On March 22, 2018

Leave a Reply

avatar
  Subscribe  
Notify of
Menu