Error::getTraceAsString
PHP function
Edit on GitHub ✎
(PHP 7, PHP 8)
Gets the stack trace as a string
Description
Error::getTraceAsString(): string
Returns the stack trace as a string.
Parameters Parameters
Return Values
Returns the stack trace as a string.
Examples
Error::getTraceAsString() example
php
<?php
function test() {
throw new Error;
}
try {
test();
} catch(Error $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