Definition :
The getLine()
method is used to returns the line number of the line of code which threw the exception.
$exception->getLine()
No parameter is required.
Returns the line number where the exception was created.
Given below example throw an exception and then output the number of the line on which it was thrown:
Output : 7