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); ?>
(PHP 7, PHP 8)
Error::getCode — Gets the error code
Questa funzione non contiene parametri.
Returns the error code as int
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