Php/docs/errorexception.getseverity

提供:Dev Guides
< Php
移動先:案内検索

ErrorException::getSeverity

(PHP 5 >= 5.1.0, PHP 7, PHP 8)

ErrorException::getSeverity例外の深刻度を取得する


説明

final public ErrorException::getSeverity ( ) : int

例外の深刻度を返します。


パラメータ

この関数にはパラメータはありません。


返り値

例外の深刻度レベルを返します。


例1 ErrorException::getSeverity() の例

<?phptry {    throw new ErrorException("Exception message", 0, E_USER_ERROR);} catch(ErrorException $e) {    echo "This exception severity is: " . $e->getSeverity();    var_dump($e->getSeverity() === E_USER_ERROR);}?>

上の例の出力は、 たとえば以下のようになります。


This exception severity is: 256
bool(true)