Problem Statement
How can you retrieve details about an exception in PHP?
Explanation
An Exception object provides methods like getMessage(), getCode(), getFile(), and getLine(). They help identify the reason and location of an error.
Example:
try { throw new Exception('Missing file'); }
catch (Exception $e) {
echo $e->getMessage();
echo $e->getFile();
}
Code Solution
SolutionRead Only
$e->getMessage(); $e->getFile();
