exit

(PHP 3, PHP 4, PHP 5 )

exit -- Output a message and terminate the current script

Description

void exit ( [string status] )

void exit ( int status )

Notatka: This is not a real function, but a language construct.

Notatka: PHP >= 4.2.0 does NOT print the status if it is an integer.

The exit() function terminates execution of the script. It prints status just before exiting.

If status is an integer, that value will also be used as the exit status. Exit statuses should be in the range 0 to 254, the exit status 255 is reserved by PHP and shall not be used. The status 0 is used to terminate the program successfully.

Przykład 1. exit() example

<?php

$filename
= '/path/to/data-file';
$file = fopen($filename, 'r')
    or exit(
"unable to open file ($filename)");

?>

Przykład 2. exit() status example

<?php

//exit program normally
exit;
exit();
exit(
0);

//exit with an error code
exit(1);
exit(
0376); //octal

?>

Notatka: The die() function is an alias for exit().

See also: register_shutdown_function().



Język PHP to dzisiaj powszechnie przyjęty standard, podstawa tworzenia dynamicznych stron WWW, opartych na bazach danych.

PHP to język skryptowy. Znaczy to, że jest to język nie kompilowalny. Program jest wykonywany przez interpreter na podstawie jego kodu źródłowego. Język PHP to element technologii internetowej SERVER-SIDE. Znaczy to, że kod języka jest wykonywany od strony serwera (na serwerze).

W jakim celu używac PHP? Po co to komu?

Załóżmy, że potrzebujemy takiej strony internetowej, która wyświetli zawsze bieżącą datę. Dzięki technologii PHP, datę i godzinę odczytywać można z miejsca gdzie wykonuje się skrypt, np. gdy serwer znajduje się w USA a my w Polsce to widoczna jest różnica w czasie który zostanie wyświetlony.

reklama LED Gdzie?!?Hur gĺr det med mina przy baza ofert pracy baza ofert pracy skarbowy czlonkostwoagroturystyka kaszuby, wizy do rosji, wiza do rosji, powiększanie ust, wizy do rosji, usuwanie zmarszczek, wizy do rosji, angielski wrocław, noclegi Świnoujście, serwer prywatny