Exception::getTraceAsString
PHP function
Edit on GitHub ✎
(PHP 5, PHP 7, PHP 8)
Gets the stack trace as a string
Description
Exception::getTraceAsString(): string
Returns the Exception stack trace as a string.
Parameters Parameters
Return Values
Returns the Exception stack trace as a string.
Examples
Exception::getTraceAsString() example
php
<?php
function test() {
throw new Exception;
}
try {
test();
} catch(Exception $e) {
echo $e->getTraceAsString();
}
?>The above example will output something similar to:
output
#0 /home/bjori/tmp/ex.php(7): test()
#1 {main}See Also
Throwable::getTraceAsString