PHP Exception getTraceAsString() Method

PHP Exception getTraceAsString Method


Definition :

The getTraceAsString() method returns a stack trace in the form of a string.

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.

Syntax

     $exception->getTraceAsString()

Parameters

    No parameter is required.

Return Value

   Returns the Exception stack trace as a string.

Given below example Output the stack trace:

Output : #0 C:\xampp\htdocs\php\php Exception\getTraceAsString().php(11): myFunction(5) #1 {main}