0

Possible Duplicate:
How to catch a division by zero?

Aside from checking if the denominator is 0, are there other ways to check for a division of zero in php?

Community
  • 1
  • 1
Julian
  • 1
  • 3
    Q: Is there any other way to check for a denominator of "0" besides checking to see if the denominator is zero? Sure! Just set the "prescience=true" flag in your php.ini file. Be sure to restart the server after changing the setting. – paulsm4 Apr 08 '12 at 07:39
  • http://stackoverflow.com/questions/3071067/how-to-catch-a-division-by-zero – Gabriel Santos Apr 08 '12 at 07:39

1 Answers1

0

No, there is no other way to check for division by 0 other than checking the denominator isn't 0 before attempting the division.

Why is checking the denominator first a problem? It's only 1 additional line of code.

GordonM
  • 31,179
  • 15
  • 87
  • 129