How to handle errors in PHP?
We can have any kind of error in our code ,so we need to handle the error.
Example:the desired file you are looking for may not exit,so this error can be handled as:
Without Error handling:
/*Output of the above program is:
Warning: fopen(hello.txt) [function.fopen]: failed to open stream:
No such file or directory in C:\webfolder\test.php on line 2
die("File not found");
File not found
Error may arise when programming code is prepared.
If errors are handled and checked properly ,your program looks professional.Thus error handling plays important role here.