<?php … throw new Exception(“Division by zero”, 1); … ?> |
The Exception() constructor is used to create an Exception object and initialize its properties.
new Exception(message, code, previous) |
Parameter |
Description |
message |
Optional. A string explaining the reason for the exception. |
code |
Optional. An integer used to differentiate this exception from others of the same type. |
previous |
Optional. If this exception was thrown within a |