How to suppress the \"Division by zero\" error and set the result to null for the whole application? By saying \"for the whole application\", I mean it is n
This is a horrible solution, but thankfully, you won't use it because the variable is set to false
instead of null
.
function ignore_divide_by_zero($errno, $errstring)
{
return ($errstring == 'Division by zero');
}
set_error_handler('ignore_divide_by_zero', E_WARNING);
In your case, I'd create a function that does your division for you.