getMessage
Returns a string describing the reason for the exception being thrown.
getMessage()
method returns a description of the error or behavior that caused the exception to be thrown.
Tutorial: PHP exception
Throw an exception and output its message:
<?php try { throw new Exception ( "An error occurred" ) ; } catch ( Exception $e ) { echo $e -> getMessage ( ) ; } ?>
Try it yourself
$exception -> getMessage ( )