Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What does !== comparison operator in PHP mean?

I saw

if($output !== false){
}

It's an exclamation mark with two equals signs.

It almost works like not equal. Does it has any extra significance?

like image 404
Thejesh GN Avatar asked Aug 19 '09 06:08

Thejesh GN


1 Answers

They are the strict equality operators ( ===, !==) , the two operands must have the same type and value in order the result to be true.

For example:

var_dump(0 == "0"); //  true
var_dump("1" == "01"); //  true
var_dump("1" == true); //  true

var_dump(0 === "0"); //  false
var_dump("1" === "01"); //  false
var_dump("1" === true); //  false

More information:

  • PHP Comparison Operators
like image 101
Christian C. Salvadó Avatar answered Sep 19 '22 13:09

Christian C. Salvadó