跳转到主要内容

getcode

Error::getCode

Gets the error code

ENTITY

final

public

int

Error::getCode

Returns the error code.

ENTITY ENTITY

ENTITY

Returns the error code as int

ENTITY

Error::getCode example

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

    

ENTITY

The Error code is: 30

ENTITY

Throwable::getCode