Note that it appears to be the line number the Exception was created that is returned, *not* the line it was thrown from.
See this bug:
http://bugs.php.net/bug.php?id=53882
Wanted to note that here until documentation is fixed or bug report dealt with.
Exception::getLine
(PHP 5 >= 5.1.0)
Exception::getLine — 例外が発生した行を取得する
説明
final public int Exception::getLine
( void
)
例外が作られた行番号を取得します。
パラメータ
この関数にはパラメータはありません。
返り値
例外が作られた行番号を返します。
例
例1 Exception::getLine() の例
<?php
try {
throw new Exception("Some error message");
} catch(Exception $e) {
echo "The exception was created on line: " . $e->getLine();
}
?>
上の例の出力は、 たとえば以下のようになります。
The exception was created on line: 3
James
02-Feb-2011 07:20
