![]() ![]() Therefore, the code after the throw statement won’t execute. When PHP encounters a throw statement, it immediately halts the code execution. Note that the Exception class also implements the Throwable interface. In fact, it accepts any object that implements the Throwable interface. Each try must have at least one corresponding catch or finally block. Code may be surrounded in a try block, to facilitate the catching of potential exceptions. An exception can be throw n, and caught (' catch ed') within PHP. Exceptions are thrown by many PHP functions and classes. ![]() The throw statement accepts an instance of the Exception class or the subclass of the Exception class. PHP has an exception model similar to that of other programming languages. An exception is an object that describes an error or unexpected behaviour of a PHP script. Instead, you raise (or throw) the Exception object using the throw statement:
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |