array ( 0 => 'index.php', 1 => 'PHP Manual', ), 'head' => array ( 0 => 'UTF-8', 1 => 'it', ), '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); ?>
(PHP 7, PHP 8)
Error::getLine — Gets the line in which the error occurred
Questa funzione non contiene parametri.
Returns the line number where the error occurred.
Example #1 Error::getLine() example
<?php
try {
throw new Error("Some error message");
} catch(Error $e) {
echo "The error was created on line: " . $e->getLine();
}
?>Il precedente esempio visualizzerĂ qualcosa simile a:
The error was created on line: 3