Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

All of this I can understand, but why then octal numbers are not compared the same way is beyond me?

    var_dump(0xA == '0xA'); // bool(true)
    var_dump(012 == '012'); // bool(false)


Check out which types those examples get cast to and it should make more sense :) I don't know the exact rules for type detection in PHP, but it looks like that's the cause.




Consider applying for YC's Summer 2026 batch! Applications are open till May 4

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: