array ( 0 => 'index.php', 1 => 'PHP Manual', ), 'head' => array ( 0 => 'UTF-8', 1 => 'fr', ), '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' => 'fr', '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 — Récupère la sévérité de l'exception
Cette fonction ne contient aucun paramètre.
Retourne le degré de sévérité de l'exception.
Exemple #1 Exemple avec ErrorException::ErrorException()
<?php
try {
throw new ErrorException("Exception message", 0, E_USER_ERROR);
} catch(ErrorException $e) {
echo "La sévérité de l'exception est : " . $e->getSeverity();
var_dump($e->getSeverity() === E_USER_ERROR);
}
?>
Résultat de l'exemple ci-dessus est similaire à :
La sévérité de l'exception est : 256 bool(true)