Example
Throw an exception and then output the number of the line on which it was thrown:
html
<?php
try {
throw new Exception("An error occurred");
}
catch(Exception $e) {
echo $e->getLine();
}
?>
Definition and Usage
The getLine() method returns the line number of the line of code which threw the exception.
Syntax
text
$exception->getLine()
Technical Details
| Return Value: | Returns an integer |
|---|