Dutch PHP Conference 2025 - Call For Papers

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}

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

add a note

User Contributed Notes

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