Error::getCode

エラーコードを取得する

説明

final public int Error::getCode()

エラーコードを返します

パラメータ

この関数にはパラメータはありません。

戻り値

エラーコードを int 型として返します

例1 Error::getCode の例

<?php
try {
    throw new 
Error("Some error message"30);
} catch(
Error $e) {
    echo 
"The Error code is: " $e->getCode();
}
?>

上の例の出力は、 たとえば以下のようになります。

The Error code is: 30

参考

  • Throwable::getCode