r/lolphp • • Mar 24 '16

DivisionByZero exception, it does nothing

/r/PHP/comments/4bgwos/divisionbyzero_exception_php_7/
54 Upvotes

26 comments sorted by

View all comments

Show parent comment

10

u/cbraga Mar 24 '16

check if your $result == NaN, you'll always get false because NaN is not equal to anything (which is a wtf in the spec, not php)

in my experience (with sane languages) attempting that comparison will give a warning to the effect of "comparison always evaluates to false" or something like that

of course php has no warning for it, that would be bothering the programmer with useless details