I'm comparing two strings like so:
<?php
$Str1 = '111122223333444455556666';
$Str2 = '111122223333444455557777';
if($Str1 != $Str2){
// Do something
} else {
// Do something else
}
?>
Obviously, $Str1 is not the same as $Str2, but still always executes the else-block. I know that I should simply use ===
or !==
to compare here, but I'm wondering why (basically) any other value I try does in fact evaluate the way it's expected to.
I also read this in the documentation "If the string does not contain any of the characters '.', 'e', or 'E' and the numeric value fits into integer type limits (as defined by PHP_INT_MAX), the string will be evaluated as an integer.", so I'm guessing it should not be below or the same as the value of PHP_INT_MAX (which is by far less than the strings I'm evaluating above) - assuming that's what they mean by "fits into". So why are the strings above being evaluated as being the same? Could it possibly be a PHP bug or is there something I'm missing?
I'm using PHP version 5.3.8 since yesterday, coming from PHP 5.3.6. Running on Windows XP.