Exception
PHP Manual

Exception::getCode

(PHP 5 >= 5.1.0)

Exception::getCode — Gets the Exception code

Описание

final public int Exception::getCode ( void )

Returns the Exception code.

Список параметров

This function has no parameters.

Возвращаемые значения

Returns the Exception code as a integer.

Примеры

Пример #1 Exception::getCode() example

<?php
try {
    throw new 
Exception("Some error message", 30);
} catch(
Exception $e) {
    echo 
"The exception code is: " . $e->getCode();
}
?>

Результатом выполнения данного примера будет что-то подобное:

The exception code is: 30


Exception
PHP Manual