Though every programming language offers default error handling methods. You can also write your own error handling functions in PHP.
There is a bit difference between user defined error handling method and a default error handling techniques.
In a default error handling method, program will throw a error message with filename, error message describing the error along with the line
number where error has occurred. But in a user defined error handling you can throw a well defined error message that helps you to find and
rectify error easily.
Given are the types of PHP Error Handling Functions:
In PHP die( ) method is used to handle simple and basic errors in PHP. For example if your program is not able to find or located any file or variable then it will simply die, instead of sending an error message to user.
Where as a Custom error handler or triggering is used to trigger a error when user is not entering a desirable input.
Error reporting is a method to send an error message to the user. By default PHP sends an error message to user with line number, error message and file names. But in case of using error reporting method you can send a well defined error message to users on entering a wrong data or input.
Go through the given error handling tutorial for example code.
Rs. 20,000 US$ 300
Today: Rs. 10,000 US$150
Course Duration: 30 hrs
Posted on: December 19, 2013 If you enjoyed this post then why not add us on Google+? Add us to your Circles