PHP Exception getPrevious() Method

PHP Exception getPrevious Method


Definition :

In this method If the exception was triggered by another one, then the getPrevious() method returns the other exception. Otherwise it returns null.

Syntax

   $exception->getPrevious()

Given below example use of getPrevious method

Output : 

Exception: An error occurred in  C:\xampp\htdocs\php\php Exception\getPrevious().php:8
Stack trace:
#0 {main}An error occurred