Exception::getCode
(PHP 5, PHP 7, PHP 8)
Exception::getCode — 例外コードを取得する
パラメータ
この関数にはパラメータはありません。
例
例1 Exception::getCode() の例
<?phptry { throw new Exception("Some error message", 30);} catch(Exception $e) { echo "The exception code is: " . $e->getCode();}?>
上の例の出力は、 たとえば以下のようになります。
The exception code is: 30