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 — Récupère la ligne dans laquelle l'exception est survenue
Description
final public int Exception::getLine
( void
)
Récupère le numéro de la ligne où l'exception a été créée.
Liste de paramètres
Cette fonction ne contient aucun paramètre.
Valeurs de retour
Retourne le numéro de la ligne où l'exception a été créée.
Exemples
Exemple #1 Exemple avec Exception::getLine()
<?php
try {
throw new Exception("Un message d'erreur");
} catch(Exception $e) {
echo "L'exception a été créée depuis la ligne : " . $e->getLine();
}
?>
L'exemple ci-dessus va afficher quelque chose de similaire à :
L'exception a été créée depuis la ligne : 3
James
03-Feb-2011 03:20
