Created
March 22, 2012 14:27
-
-
Save mhujer/2158624 to your computer and use it in GitHub Desktop.
Unexpected PHP behaviour when comparing number strings.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$a = '00020001000200120005'; | |
$b = '00020001000200120003'; | |
var_dump($a == $b); //true | |
var_dump($a === $b); //false | |
var_dump(strcmp($a, $b)); //1 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment