PHP Exception getLine() Method

PHP Exception getLine Method


Definition :

The getLine() method is used to returns the line number of the line of code which threw the exception.

Syntax

   $exception->getLine()

Parameters

    No parameter is required.

Return Value

  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