Current Location: Home> Function Categories> Exception

Exception

Exception object constructor.
Name:Exception
Category:Uncategorized
Programming Language:php
One-line Description:Exception object constructor.

Definition and usage

Exception() constructor is used to create an Exception object and set some of its properties.

Related pages

Tutorial: PHP exception

Example

 <?php
...
throw new Exception ( "Division by zero" , 1 ) ;
...
?>

Try it yourself

grammar

 new Exception ( message , code , previous )
parameter describe
message Optional. A string describing the reason for the exception being thrown.
code Optional. Integer, can be used to easily distinguish this exception from other exceptions of the same type.
Previous Optional. If this exception is raised in another exception's catch block, it is recommended to pass that exception into this parameter.
Similar Functions
Popular Articles