Handling a specific type of exceptions in PHP code
By default try/catch block will handle all the errors. What to do if a specific error type needs to be handled, but if a different error happens, then a different code needs to be executed. In this case it is possible to specify which type of exception will be handled by an except block. Name of the exception needs to specified in the parentheses that followed catch statement. Exception message will be stored in a variable that follows that exception type.
Comments
Post a Comment