What Is Meant by "Identity Comparison" in PHP?

Find out what the term "identity comparison" refers to in PHP

In PHP, identity comparison refers to comparisons made using the identity comparison operators (i.e. === and !==), which compare its operands strictly.

For example, two operands are identical (or strictly equal) when their values are equal, and they're both of the same type:

$a = '8.0';
$b = '8.0';

var_dump($a === $b); // bool(true)
$a = '8.0';
$b = 8.0;

var_dump($a === $b); // bool(false)

Conversely, two operands are not identical (or strictly not equal) when their values are not equal, or they're not of the same type. For example:

$a = '8.0';
$b = 8.0;

var_dump($a !== $b); // bool(true)
$a = '8.0';
$b = '8.0';

var_dump($a !== $b); // bool(false)

Hope you found this post useful. It was published . Please show your love and support by sharing this post.