Hacker News new | ask | show | jobs
by xerophyte12932 3490 days ago
Wait, is GP saying that IS true in php?!?!
3 comments

My favorite is that two obviously different hexadecimal values in strings (e.g. checking password hashes) can be "equal" with the weaker == comparison.

This occurs if PHP thinks both strings could be numbers in scientific notation. "0e123" == "00e45"

It gets worse: https://3v4l.org/Slvpp

Note that PHP also has a JavaScript-style triple-equals comparison, which does not attempt type conversion and does not exhibit this bizarre behaviour.

Yeah, go check in a sandbox.