开发者

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;
}
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜