Throw an exception and then display the line number where it was thrown.
<?php try { throw new Exception(“An error occurred”); } catch(Exception $e) { echo $e->getLine(); } ?> |
The getLine() method returns the line number of the code that threw the exception.
$exception->getLine() |
Return Value: |
Returns an integer value. |