Skip to content

Instantly share code, notes, and snippets.

@andreastt
Created January 12, 2011 11:49
Show Gist options
  • Save andreastt/776058 to your computer and use it in GitHub Desktop.
Save andreastt/776058 to your computer and use it in GitHub Desktop.
PHP comparison FAIL
<?php
$a = "0xF14067C1C600003D";
$b = $a;
echo '$a = ';var_dump($a);
echo '$b = ';var_dump($b);
if($a == $b) {
echo "\$a == \$b\n";
} else {
echo "\$a != \$b\n";
}
if($a === $b) {
echo "\$a === \$b\n";
} else {
echo "\$a !== \$b\n";
}
?>
Output:
$a = string(18) "0xF14067C1C600003D"
$b = string(18) "0xF14067C1C600003D"
$a != $b
$a === $b
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment