getCode
Returns the exception code.
getCode() method returns an integer that can be used to identify exceptions.
Tutorial: PHP exception
Throw an exception and output its code:
<?php
try {
throw new Exception ( "An error occurred" , 120 ) ;
} catch ( Exception $e ) {
echo "Error code: " . $e -> getCode ( ) ;
}
?>
Try it yourself
$exception -> getCode ( )