« get_browser
highlight_file »

__halt_compiler

(PHP 5 >= 5.1.0, PHP 7, PHP 8)

__halt_compiler — コンパイラの実行を中止する

説明

function __halt_compiler(): void

コンパイラの実行を中止します。 これは、インストール用ファイルのようなデータを PHP スクリプトに埋め込んでいる場合に便利です。

データの開始位置(バイト値)は、定数 __COMPILER_HALT_OFFSET__ で定義されています。 これはファイル内で __halt_compiler() が使用されている場合にのみ存在します。

パラメータ

この関数にはパラメータはありません。

戻り値

値を返しません。

例

例1 __halt_compiler() の例

<?php

// このファイルをオープンします
$fp = fopen(__FILE__, 'r');

// データのある位置までファイルポインタを移動します
fseek($fp, __COMPILER_HALT_OFFSET__);

// それを出力します
var_dump(stream_get_contents($fp));

// ここでスクリプトの実行を終了します
__halt_compiler(); インストールデータ(例: tar, gz, PHP など..)

注意

注意:

__halt_compiler() は、いちばん外側のスコープでのみ使用可能です。

関連キーワード:
halt   compiler   コンパイラ   中止   スクリプト   browser   highlight   便利   開始   バイト   定数   オープン   fopen   ポインタ   fseek   dump   stream   contents   外側   スコープ
関連する関数・ページ:
reserved.keywords   parle.requirements   function.get-browser   function.highlight-file   function.stream-get-contents   misc.configuration