How to hide the divide by zero exception in php?
i tried this error_reporting(E_ERROR | E_WARNING | E_PARSE | E_NOTICE);
but its not working and printing the error like this...
Warning: Division by zero in C:\wamp\www\adman\webpage1\e开发者_开发问答learning.php on line 276
This is the best way to handle it:
if ( $divisor == 0 )
{
// don't divide by zero, handle special case
} else {
$result = $number / $divisor;
}
精彩评论