Funkce PHP exit() .
Příklad
Vytiskněte zprávu a ukončete aktuální skript:
<?php
$site = "https://www.w3schools.com/";
fopen($site,"r")
or exit("Unable to connect to $site");
?>
Definice a použití
Funkce exit() vytiskne zprávu a ukončí aktuální skript.
Syntax
exit(message)
Hodnoty parametrů
Parameter | Description |
---|---|
message | Required. A message or status number to print before terminating the script. A status number will not be written to the output, just used as the exit status. |
Technické údaje
Návratová hodnota: | Nic |
---|---|
Verze PHP: | 4+ |
❮ PHP Různé Reference