array ( 0 => 'index.php', 1 => 'PHP Manual', ), 'head' => array ( 0 => 'UTF-8', 1 => 'ja', ), 'this' => array ( 0 => 'errorexception.getseverity.php', 1 => 'ErrorException::getSeverity', ), 'up' => array ( 0 => 'class.errorexception.php', 1 => 'ErrorException', ), 'prev' => array ( 0 => 'errorexception.construct.php', 1 => 'ErrorException::__construct', ), 'next' => array ( 0 => 'class.closedgeneratorexception.php', 1 => 'ClosedGeneratorException', ), 'alternatives' => array ( ), 'source' => array ( 'lang' => 'ja', 'path' => 'language/predefined/errorexception/getseverity.xml', ), ); $setup["toc"] = $TOC; $setup["toc_deprecated"] = $TOC_DEPRECATED; $setup["parents"] = $PARENTS; manual_setup($setup); ?>
(PHP 5 >= 5.1.0, PHP 7, PHP 8)
ErrorException::getSeverity — 例外の深刻度を取得する
この関数にはパラメータはありません。
例外の深刻度レベルを返します。
例1 ErrorException::getSeverity() の例
<?php
try {
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)