How can I retrieve the message-only from a fatal error message in php store it as a variable.
I'm running a script which I believe has some custom error reporting on it when it runs. When the function fails, I get this:
<b>Fatal error</b>: Uncaught exception 'functionName' with message 'the was an error' in 'filepath.php line 10'
I have error reporting turned on like this:
<?php
error_reporting( E_ALL );
ini_set( "display_errors", 1 );
?>
However, I'd like to store the error message as variable that I can use in a more user-friendly way.
So far I've tried this:
$var = error_get_last(['message']);
echo $var;
But it doesn't display anything.
Any help is much appreciated.