2

Possible Duplicate:
php == vs === operator

What's the difference between !== and != in PHP?

Community
  • 1
  • 1
Steven
  • 24,410
  • 42
  • 108
  • 130

6 Answers6

5

!== is strict not equal and which does not do type conversion

!= is not equal which does type conversion before checking

rahul
  • 184,426
  • 49
  • 232
  • 263
4

=== AND !== checks if the values compared have the same type (eg: int, string, etc.) and have the same values

While...

== AND != only compares the values

wenbert
  • 5,263
  • 8
  • 48
  • 77
3
"1" != 1     // False
"1" !== 1    // True

It's a type thing. !== takes into account the types of its operands, while != does not (the implicit conversion makes the first conditional false).

Jed Smith
  • 15,584
  • 8
  • 52
  • 59
3

== is only true if the values are equal. === is only true if the values and types are equal.

Jordan S. Jones
  • 13,703
  • 5
  • 44
  • 49
1

the triple equal also make sure the two variable are from the same type

1 == `1` // is ok
1 === `1` // is not same.
RageZ
  • 26,800
  • 12
  • 67
  • 76
1

Both are comparion operators

  • $a !== $b Return TRUE if $a is not equal to $b, or they are not of the same type.
  • $a != $b Return TRUE if $a is not equal to $b.
NinethSense
  • 8,824
  • 2
  • 23
  • 23