== and === operator in PHP
What is the difference between == and === operator in PHP ? In PHP == is equal operator and returns TRUE if $a is equal to $b after type juggling and === is Identical operator and return TRUE if $a is equal to $b, and they are of the same data type
<?php 
 $a=true ;
 $b=1;
 // Below condition returns true and prints a and b are equal
 if($a==$b){
  echo "a and b are equal";
 }
 else{
  echo "a and b are not equal";
 }
 //Below condition returns false and prints a and b are not equal because $a and $b are of  different data types.
 if($a===$b){
  echo "a and b are equal";
 }
 else{
  echo "a and b are not equal";
 }
?>
``
by Tinatin Kvinikadze
2 years ago
PHP
operator
0
Pro tip: use ```triple backticks around text``` to write in code fences