getLine
Returns the line number of the line of code that throws the exception.
getLine() method returns the line number of the code that threw the exception.
Tutorial: PHP exception
Throw an exception and then output the line number of the code that throws the exception:
<?php
try {
throw new Exception ( "An error occurred" ) ;
} catch ( Exception $e ) {
echo $e -> getLine ( ) ;
}
?>
Try it yourself
$exception -> getLine ( )