PHP 8.3.4 Released!

Exception::__toString

(PHP 5, PHP 7, PHP 8)

Exception::__toStringRepresentación de la excepción en formato cadena

Descripción

public Exception::__toString(): string

Devuelve la representación de la excepción en formato string.

Parámetros

Esta función no tiene parámetros.

Valores devueltos

Devuelve la representación de la excepción en formato string.

Ejemplos

Ejemplo #1 Ejemplo de Exception::__toString()

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

El resultado del ejemplo sería algo similar a:

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

Ver también

add a note

User Contributed Notes

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