What is the difference between == and === in php

Possible duplicate:
3 different meanings

Is there a difference between == and === in php? both seem to work just fine for me when I use them in a conditional statement. I am very new to PHP programming. Please consider this and answer in simple words.

+4
source share
2 answers
  • $a == $b

Equal true : if $a is equal to $b , after type manipulation.


  • $a === $b

Identical true : if $a is equal to $b , and they are of the same type .

+11
source

Identical:

$a === $b

TRUE if $a from equal to $b , and they are of the same type. (introduced in PHP 4 )

Equal:

$a == $b

TRUE if $a equals $b after type manipulation.

Read more here: http://www.php.net/manual/en/language.operators.comparison.php

+4
source

All Articles