Home > Article > Backend Development > What happens when the same numbers in PHP are not equal?
When PHP determines that the same numbers are not equal, it means that although they have the same value, their types are different. Therefore, when using the comparison operator equals symbol "===" in PHP to determine that two are the same When the number is , return false, indicating that the types are different.
The operating environment of this article: windows7 system, PHP7.1 version, DELL G3 computer
When the same numbers in PHP are judged to be unequal, It means that although their values are the same, their types are different. Therefore, when the comparison operator equals symbol "===" is used to judge two identical numbers and returns false, it means that the types are different.
==, equal to, $x == $y, returns true if $x is equal to $y.
===, congruent (identical), $x === $y, returns true if $x is equal to $y and they are of the same type.
Example:
<?php $x = 17; $y = "17"; var_dump($x === $y); // 返回 false,因为类型不同 ?>
Output result:
bool(false)
Recommended learning: "PHP Video Tutorial"
The above is the detailed content of What happens when the same numbers in PHP are not equal?. For more information, please follow other related articles on the PHP Chinese website!