PHP Exception Handler | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

PHP Exception Handler

When an error occurred PHP script displays a fatal error. To avoid the error you should need to write the proper code to handle the exception in PHP script. PHP exception handler is a smart way to handle the exceptional condition. //trigger exception in try block and catch exception try {     //something } catch (Exception $e) {     echo 'Message: ' .$e->getMessage(); }

23rd Sep 2017, 7:04 PM
Nohman Rauf
Nohman Rauf - avatar
1 Answer
+ 8
Or even better... make your own exception classes: https://code.sololearn.com/wE7zBruG55Z5/?ref=app
23rd Sep 2017, 8:47 PM
Maz
Maz - avatar