Skip to content

Instantly share code, notes, and snippets.

@mhujer
Created March 22, 2012 14:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mhujer/2158624 to your computer and use it in GitHub Desktop.
Save mhujer/2158624 to your computer and use it in GitHub Desktop.
Unexpected PHP behaviour when comparing number strings.
<?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