Start · Sprachen · PHP · Referenz · Error

Error

Klasse

Basis-Klasse für interne PHP-Fehler wie <code>TypeError</code>, <code>ValueError</code>, <code>ParseError</code>.

seit PHP 7.0.0 Kategorie: error

Signatur

class Error implements Throwable

Beschreibung

Anders als Exception für System-/Compile-Fehler. Beide implementieren Throwablecatch (\Throwable $e) fängt beide.

Rückgabewert

Typ
Error
Beschreibung
Instanz.

Beispiele

Catch-All

<?php

try {
    riskyThing();
} catch (\Throwable $t) {
    // fängt Exceptions UND Errors
    logger()->error($t);
}

Siehe auch