如何在php中隐藏除零异常?

Dix*_*ani -2 php

我试过这个 error_reporting(E_ERROR | E_WARNING | E_PARSE | E_NOTICE);

但它没有工作,并打印出这样的错误......

警告:在第276行的C:\ wamp\www\adman\webpage1\elearning.php中除以零

mvd*_*vds 10

这是处理它的最佳方法:

if ( $divisor == 0 )
{
     // don't divide by zero, handle special case
} else {
     $result = $number / $divisor;
}
Run Code Online (Sandbox Code Playgroud)