Exception handling is available in PHP since version 5. It allows you to have a more fine-grained control over code when things go wrong ie, when exceptions occur.
Put your codes inside try block. if an error occur then the code inside your catch block will run. There is also one more bock. i.e finally (PHP 5.5) which will be called every time your code will run. You can hierarchically use these blocks.
Useful link: https://adayinthelifeof.nl/2013/02/12/php5-5-trycatchfinally/
try {
//Your codes
} catch (Exception $e) {
//when above codes gives error
do nothing and go back to index page;
}
2
solved Tell server to not run the code when there is an error