Definition :
The getCode()
method returns an integer which can be used to identify the exception.
$exception->getCode()
No parameter is required.
Given below example Shows the Exception getCode() method.
Output : The exception code is: 25