Exception::getLine

(PHP 5, PHP 7, PHP 8)

Exception::getLineObtém a linha na qual a exceção ocorreu

Descrição

final public Exception::getLine ( ) : string

Retorna o número da linha onde a exceção foi disparada.

Parâmetros

Esta função não possui parâmetros.

Valor Retornado

Retorna o número da linha onde a exceção foi disparada.

Exemplos

Exemplo #1 Exemplo da Exception::getLine()

<?php
try {
    throw new 
Exception("Some error message");
} catch(
Exception $e) {
    echo 
"The exception was thrown on line: " $e->getLine();
}
?>

O exemplo acima irá imprimir algo similar à:

The exception was thrown on line: 3

Veja Também

add a note add a note

User Contributed Notes

There are no user contributed notes for this page.
To Top