What is the difference between == and === in PHP?


amitupadhyayvns

Well, it’s quite simple. The == operator just checks to see if the left and right values are equal. But, the === operator (note the extra “=”) actually checks to see if the left and right values are equal, and also checks to see if they are of the same variable type (like whether they are both booleans, ints, etc.).

Example

<?PHP

$a=0;

$b=false;

if($a==$b)

{

echo “True”;

}

else

{

echo “False”;

}

?>

<?PHP

$a=0;

$b=false;

if($a===$b)

{

echo “True”;

}

else

{

echo “False”;

}

?>

View original post