PHP Exception Constructor
Voorbeeld
<?php
...
throw new Exception("Division by zero", 1);
...
?>
Definitie en gebruik
De Exception()
constructor wordt gebruikt om een Exception-object te maken en enkele van zijn eigenschappen in te stellen.
Syntaxis
new Exception(message, code, previous)
Parameterwaarden
Parameter | Description |
---|---|
message | Optional. A string describing why the exception was thrown |
code | Optional. An integer that can be used used to easily distinguish this exception from others of the same type |
previous | Optional. If this exception was thrown in a catch block of another exception, it is recommended to pass that exception into this parameter |
Gerelateerde pagina's
Lees meer over Exceptions in ons PHP Exceptions Chapter .
❮ Referentie PHP-uitzondering