exit

(PHP 3, PHP 4 )

exit -- メッセージを出力し、カレントのスクリプトを終了する

説明

void exit ( [string status])

注意 この関数は実際には関数ではなく言語構造です。

exit() 関数は、スクリプトの実行を終了します。 終了直前に status を出力します。

status integer の場合、その値 も終了ステータスとして使用されます。

注意 カレントのCVS版は、 integer の場合、 status を出力しません。

注意 関数 die() は、 exit() のエイ リアスです。

例 1 exit() の例

 ?php

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

?