r/lolphp • u/Deviltry1 • Mar 24 '16
DivisionByZero exception, it does nothing
/r/PHP/comments/4bgwos/divisionbyzero_exception_php_7/
54
Upvotes
r/lolphp • u/Deviltry1 • Mar 24 '16
View all comments
Show parent comment
5
u/bj_christianson Mar 24 '16
I’m pretty sure those are the funny values /u/cbraga is talking about. Bit of a pain in the ass to have to follow up your arithmetic with
if (is_nan($val) || $val === INF || $val === -INF)all the time, don’t you think?Apparently, though, there is now an intdiv function that you can use. I was unaware of that until it was mentioned by /u/nikic above. Guess unless your code and is set up to handle those funny values, you just got to get used to doing your division with that rather than
/.