downloads | documentation | faq | getting help | mailing lists | licenses | wiki | reporting bugs | php.net sites | links | conferences | my php.net

search for in the

Vordefinierte Interfaces> <ErrorException::__construct
[edit] Last updated: Fri, 18 May 2012

view this page in

ErrorException::getSeverity

(PHP 5 >= 5.1.0)

ErrorException::getSeverityLiefert die Schwere der Exception

Beschreibung

final public int ErrorException::getSeverity ( void )

Gibt die Schwere der Exception zurück.

Parameter-Liste

Diese Funktion hat keine Parameter.

Rückgabewerte

Gibt die Schwere der Exception zurück.

Beispiele

Beispiel #1 ErrorException::getSeverity()-Beispiel

<?php
try {
    throw new 
ErrorException("Exception message"075);
} catch(
ErrorException $e) {
    echo 
"This exception severity is: " $e->getSeverity();
}
?>

Das oben gezeigte Beispiel erzeugt eine ähnliche Ausgabe wie:

This exception severity is: 75



add a note add a note User Contributed Notes ErrorException::getSeverity
fgaab 08-Mar-2010 06:38
Try this as replacement for error_reporting(...)

<?php
   
function exception_error_handler($errno, $errstr, $errfile, $errline ) {
       
$severity =
           
1 * E_ERROR |
           
1 * E_WARNING |
           
0 * E_PARSE |
           
0 * E_NOTICE |
           
0 * E_CORE_ERROR |
           
0 * E_CORE_WARNING |
           
0 * E_COMPILE_ERROR |
           
0 * E_COMPILE_WARNING |
           
0 * E_USER_ERROR |
           
0 * E_USER_WARNING |
           
0 * E_USER_NOTICE |
           
0 * E_STRICT |
           
0 * E_RECOVERABLE_ERROR |
           
0 * E_DEPRECATED |
           
0 * E_USER_DEPRECATED;
       
$ex = new ErrorException($errstr, 0, $errno, $errfile, $errline);
        if ((
$ex->getSeverity() & $severity) != 0) {
                       throw
$ex;
                }
    }
   
set_error_handler("exception_error_handler");
?>

 
show source | credits | sitemap | contact | advertising | mirror sites