Error::getMessage
PHP function
Edit on GitHub ✎
(PHP 7, PHP 8)
Gets the error message
Description
Error::getMessage(): string
Returns the error message.
Parameters Parameters
Return Values
Returns the error message as a string.
Examples
Error::getMessage() example
php
<?php
try {
throw new Error("Some error message");
} catch(Error $e) {
echo $e->getMessage();
}
?>The above example will output something similar to:
output
Some error messageSee Also
Throwable::getMessage