array ( 0 => 'index.php', 1 => 'PHP Manual', ), 'head' => array ( 0 => 'UTF-8', 1 => 'it', ), 'this' => array ( 0 => 'error.getcode.php', 1 => 'Error::getCode', 2 => 'Gets the error code', ), 'up' => array ( 0 => 'class.error.php', 1 => 'Error', ), 'prev' => array ( 0 => 'error.getprevious.php', 1 => 'Error::getPrevious', ), 'next' => array ( 0 => 'error.getfile.php', 1 => 'Error::getFile', ), 'alternatives' => array ( ), 'source' => array ( 'lang' => 'en', 'path' => 'language/predefined/error/getcode.xml', ), 'history' => array ( ), ); $setup["toc"] = $TOC; $setup["toc_deprecated"] = $TOC_DEPRECATED; $setup["parents"] = $PARENTS; manual_setup($setup); contributors($setup); ?>

Error::getCode

(PHP 7, PHP 8)

Error::getCodeGets the error code

Descrizione

final public Error::getCode(): int

Returns the error code.

Elenco dei parametri

Questa funzione non contiene parametri.

Valori restituiti

Returns the error code as int

Esempi

Example #1 Error::getCode() example

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

Il precedente esempio visualizzerĂ  qualcosa simile a:

The Error code is: 30

Vedere anche: