Compare two values using PHP

In PHP, Comparison operators helps to compare two values. basic comparison operators are Equal(==),Identical(===),Not equal(!= or <>), Not identical(!==), Less than(), Less than or equal to(=)

$a == $b
if $a is equal to $b then return TRUE.
$a != $b
if $a is not equal to $b then return TRUE.
$a <> $b
if $a is not equal to $b then return TRUE.
$a !== $b
if $a is not equal to $b, or not same type then return TRUE.
$a < $b
if $a is strictly less than $b then return TRUE.
$a > $b
if $a is strictly greater than $b then return TRUE.
$a <= $b
if $a is less than or equal to $b then return TRUE.
$a >= $b
if $a is greater than or equal to $b then return TRUE.
Compare value of two variable $a and $b using PHP
<?php
$a = 8;
$b = 4;
if($a==$b} {
    echo “The value of a and b are same”;
} else {
     echo “The value of a and b are not same.”
}
?>

Output : The value of a and b are not same.

Compare value of two variable $a and $b using Ternary operator in PHP
<?php
$a = 8;
$b = 4;
echo ($a==$b)?”Logical condition is true.” : “Logical condition is false”;
?>

Output : Logical condition is false.