Error::getLine

(PHP 7, PHP 8)

Error::getLineエラーが起きた行番号を取得する

説明

final public Error::getLine(): int

エラーが起きた行番号を取得します

パラメータ

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

戻り値

エラーが起きた行番号を返します

例1 Error::getLine() の例

<?php
try {
throw new
Error("Some error message");
} catch(
Error $e) {
echo
"The error was created on line: " . $e->getLine();
}
?>

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

The error was created on line: 3

参考

  • Throwable::getLine() - オブジェクトのインスタンスが作られた行番号を取得する

add a note

User Contributed Notes

There are no user contributed notes for this page.
To Top