Start · Sprachen · PHP · Referenz · trigger_error

trigger_error

Funktion

Löst manuell einen Error, Warning oder Notice aus — für User-Level-Fehler.

seit PHP 4.0.1 Kategorie: error

Signatur

trigger_error(string $message, int $error_level = E_USER_NOTICE): bool

Beschreibung

Levels: E_USER_ERROR, E_USER_WARNING, E_USER_NOTICE, E_USER_DEPRECATED. Für neue Deprecations besser das #[\Deprecated]-Attribut (PHP 8.4+).

Parameter

Name Typ Default Beschreibung
$message Pflicht string Nachricht.
$error_level int E_USER_NOTICE Level.

Rückgabewert

Typ
bool

Beispiele

Deprecation

<?php

function oldApi() {
    trigger_error('oldApi() ist veraltet, nutze newApi()', E_USER_DEPRECATED);
}