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 — Gibt die Zeile zurück, in der die Exception auftrat
Beschreibung
final public int Exception::getLine
( void
)
Gibt die Zeile zurück, in der die Exception ausgelöst wurde.
Parameter-Liste
Diese Funktion hat keine Parameter.
Rückgabewerte
Gibt die Zeile zurück, in der die Exception ausgelöst wurde.
Beispiele
Beispiel #1 Exception::getLine()-Beispiel
<?php
try {
throw new Exception("Some error message");
} catch(Exception $e) {
echo "The exception was thrown on line: " . $e->getLine();
}
?>
Das oben gezeigte Beispiel erzeugt eine ähnliche Ausgabe wie:
The exception was thrown on line: 3
