Função PHP die()
Exemplo
Imprima uma mensagem e encerre o script atual:
<?php
$site = "https://www.w3schools.com/";
fopen($site,"r")
or die("Unable to connect to $site");
?>
Definição e uso
A função die() é um alias da função exit() .
Sintaxe
die(message)
Valores de parâmetro
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. |
Detalhes técnicos
Valor de retorno: | Nenhuma coisa |
---|---|
Versão do PHP: | 4+ |
❮ Referências Diversas do PHP