Example
Use a try...catch statement to handle exceptions:
html
<?php
try {
throw new Exception("This is an exception");
}
catch(Exception $e) {
echo $e->getMessage();
}
?>
Definition and Usage
The try keyword is used to create a try...catch, or a try...catch...finally statement.
Related Pages
The throw keyword.
The catch keyword.
The finally keyword.