array ( 0 => 'index.php', 1 => 'PHP Manual', ), 'head' => array ( 0 => 'UTF-8', 1 => 'uk', ), 'this' => array ( 0 => 'error.tostring.php', 1 => 'Error::__toString', 2 => 'String representation of the error', ), 'up' => array ( 0 => 'class.error.php', 1 => 'Error', ), 'prev' => array ( 0 => 'error.gettraceasstring.php', 1 => 'Error::getTraceAsString', ), 'next' => array ( 0 => 'error.clone.php', 1 => 'Error::__clone', ), 'alternatives' => array ( ), 'source' => array ( 'lang' => 'en', 'path' => 'language/predefined/error/tostring.xml', ), 'history' => array ( ), ); $setup["toc"] = $TOC; $setup["toc_deprecated"] = $TOC_DEPRECATED; $setup["parents"] = $PARENTS; manual_setup($setup); contributors($setup); ?>

Error::__toString

(PHP 7, PHP 8)

Error::__toStringString representation of the error

Опис

public Error::__toString(): string

Returns the string representation of the error.

Параметри

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

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

Returns the string representation of the error.

Приклади

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

<?php
try {
throw new
Error("Some error message");
} catch(
Error $e) {
echo
$e;
}
?>

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

Error: Some error message in /home/bjori/tmp/ex.php:3
Stack trace:
#0 {main}

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