php8.5
Home/ Manual/ predefined / throwable/ Throwable::getCode

Throwable::getCode

PHP function Edit on GitHub ✎

(PHP 7, PHP 8)

Gets the exception code

Description

Throwable::getCode(): int

Returns the error code associated with the thrown object.

Parameters Parameters

Return Values

Returns the exception code as int in Exception but possibly as other type in Exception descendants (for example as string in PDOException).

See Also

  • Exception::getCode

Source: language/predefined/throwable/getcode.xml · from the official PHP manual (php/doc-en)