PHP 8.4.24 Released!

Error::getCode

(PHP 7, PHP 8)

Error::getCodeGets the error code

Опис

final public function Error::getCode(): int

Returns the error code.

Параметри

У цієї функції немає параметрів.

Значення, що повертаються

Returns the error code as int

Приклади

Приклад #1 Error::getCode() example

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

Поданий вище приклад виведе щось схоже на:

The Error code is: 30

Прогляньте також

add a note

User Contributed Notes

There are no user contributed notes for this page.
To Top