array ( 0 => 'index.php', 1 => 'PHP Manual', ), 'head' => array ( 0 => 'UTF-8', 1 => 'uk', ), 'this' => array ( 0 => 'error.getline.php', 1 => 'Error::getLine', 2 => 'Gets the line in which the error occurred', ), 'up' => array ( 0 => 'class.error.php', 1 => 'Error', ), 'prev' => array ( 0 => 'error.getfile.php', 1 => 'Error::getFile', ), 'next' => array ( 0 => 'error.gettrace.php', 1 => 'Error::getTrace', ), 'alternatives' => array ( ), 'source' => array ( 'lang' => 'en', 'path' => 'language/predefined/error/getline.xml', ), 'history' => array ( ), ); $setup["toc"] = $TOC; $setup["toc_deprecated"] = $TOC_DEPRECATED; $setup["parents"] = $PARENTS; manual_setup($setup); contributors($setup); ?>

Error::getLine

(PHP 7, PHP 8)

Error::getLineGets the line in which the error occurred

Опис

final public Error::getLine(): int

Get line number where the error occurred.

Параметри

У цієї функції немає параметрів.

Значення, що повертаються

Returns the line number where the error occurred.

Приклади

Приклад #1 Error::getLine() example

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

Поданий вище приклад виведе щось схоже на:

The error was created on line: 3

Прогляньте також