Exception
Exception object constructor.
Exception()
constructor is used to create an Exception object and set some of its properties.
Tutorial: PHP exception
<?php ... throw new Exception ( "Division by zero" , 1 ) ; ... ?>
Try it yourself
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. |