getTrace
Returns an array containing information about all functions that were running when the exception was thrown.
getTrace()
method returns the stack trace as an array.
The stack trace contains information about all functions running at a given moment. The stack trace provided by this method contains stack information when an exception is thrown.
Tutorial: PHP exception
Reference Manual: getTraceAsString() method
Output stack trace:
<?php function myFunction ( $num ) { throw new Exception ( "An error occurred" ) ; } try { myFunction ( 5 ) ; } catch ( Exception $e ) { print_r ( $e -> getTrace ( ) ) ; } ?>
Try it yourself
$exception -> getTrace ( )