PHP.nl

Error::getCode

Error::getCode

Gets the error code

int **Error::getCode**

Returns the error code.

Returns the error code as int

Voorbeeld: 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

Throwable::getCode

Documentatie