PHP - Error and Exception Handling
Consider this PHP code:
function divide($a, $b) {
try {
if ($b == 0) {
throw new Exception("Division by zero");
}
return $a / $b;
} catch (Exception $e) {
return $e->getMessage();
}
}
echo divide(10, 2) . "\n";
echo divide(5, 0) . "\n";What will be the output?
