पीएचपी अपवाद कंस्ट्रक्टर
उदाहरण
<?php
...
throw new Exception("Division by zero", 1);
...
?>
परिभाषा और उपयोग
कंस्ट्रक्टर का Exception()
उपयोग एक्सेप्शन ऑब्जेक्ट बनाने और उसके कुछ गुणों को सेट करने के लिए किया जाता है।
वाक्य - विन्यास
new Exception(message, code, previous)
पैरामीटर मान
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 |
संबंधित पृष्ठ
हमारे PHP अपवाद अध्याय में अपवादों के बारे में और पढ़ें ।
❮ पीएचपी अपवाद संदर्भ