Comparison_Operators

 <?php

    $a = 10;
    $b = 10;
    $c = 22;
    $d = 23;
    $e = "10";
    $m = 60;
    $n = "60";
    // echo $a == $b;
    // echo "<br>";
    // echo $c === $d;
    // echo "<br>";
    // echo $m == $n;
    // echo "<br>";
    // echo $m === $n;//"===" means "value" as well as "Data types" must be same of Two variables
    // echo "<br>";
    // echo $c != $d;  //"!=" and "<>" both the Operators are same, meaning is "Not Equal to"
    // echo "<br>";
    // echo $c <> $d;
    echo "<br>";
    //"!==" means that value of c and d is not equal as well as their data types also not equal
    // echo $c !== $d;
    echo "<br>";
    // echo $a !== $e;
    echo "<br>";
    // echo $a > $b;
    // echo $a < $b;
    //Below Spaceship operator returns -1,0 OR 1 respectively less than, equal to, OR greater than
    echo $a <=> $b;
    echo "<br>";
    echo $a <=> $c;
    echo "<br>";
    echo $m <=> $d;

//OUTPUT:
//0
//-1
//1
   
?>

Comments

Popular posts from this blog

GROUP BY Clause and HAVING Clause in PHP

Method Overriding in Traits in PHP

Mysqli database Connection and Display Table Data from Database