Definition :
The getTrace()
method returns a stack trace in the form of an array.
Stack traces contain information about all of the functions that are running at a given moment. The stack trace provided by this method has information about the stack at the time that the exception was thrown.
$exception->getTrace()
No parameter is required.
Given below example
Output the stack trace:
Output :