The !=
operator compares value, while the !==
operator compares type as well.
That means this:
var_dump(5!="5"); // bool(false)
var_dump(5!=="5"); // bool(true), because "5" and 5 are of different types
More Related Contents:
- The 3 different equals
- Reference — What does this symbol mean in PHP?
- Stacking Multiple Ternary Operators in PHP
- ‘AND’ vs ‘&&’ as operator
- Comparing String to Integer gives strange results
- How to mathematically evaluate a string like “2-1” to produce “1”?
- Suppress error with @ operator in PHP
- Is there a “nullsafe operator” in PHP?
- What is the “->” PHP operator called? [closed]
- Logical Operators, || or OR?
- What is the meaning of three dots (…) in PHP?
- Difference between “not equal” operators and != in PHP
- What’s the difference between ++$i and $i++ in PHP?
- In PHP, what does “
- What do the “=&” and “&=” operators in PHP mean?
- Not equal to != and !== in PHP
- Understanding PHP & (ampersand, bitwise and) operator
- PHP compare array
- Can you append strings to variables in PHP? [duplicate]
- Double not (!!) operator in PHP
- What does “===” mean? [duplicate]
- In PHP, is there a short way to compare a variable to multiple values?
- PHP check value against multiple values with OR-operator
- Type-juggling and (strict) greater/lesser-than comparisons in PHP
- Reference Guide: What does this symbol mean in PHP? (PHP Syntax)
- How does PHP compare strings with comparison operators?
- Dynamic Comparison Operators in PHP
- What is the difference between the | and || operators?
- ‘At’ symbol before variable name in PHP: @$_POST
- Interview question: In php, is 123==0123?