PHP.mk документација

__halt_compiler

Почист и полокален преглед на PHP референцата, со задржана структура од PHP.net и подобра читливост за примери, секции и белешки.

function.halt-compiler.php PHP.net прокси Преводот се освежува
Оригинал на PHP.net
Патека function.halt-compiler.php Локална патека за оваа страница.
Извор php.net/manual/en Оригиналниот HTML се реупотребува и локално се стилизира.
Режим Прокси + превод во позадина Кодовите, табелите и белешките остануваат читливи во истиот тек.
__halt_compiler

Референца за `function.halt-compiler.php` со подобрена типографија и навигација.

function.halt-compiler.php

__halt_compiler

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

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

= NULL

__halt_compiler(): void

Го запира извршувањето на компајлерот

Го запира извршувањето на компајлерот. Ова може да биде корисно за вградување податоци во PHP скрипти, како што се инсталациони датотеки. __COMPILER_HALT_OFFSET__ Бајт позицијата на почетокот на податоците може да се одреди со __halt_compiler() константа која е дефинирана само ако има

Параметри

Оваа функција нема параметри.

Вратени вредности

Не се враќа вредност.

Примери

ако е овозможен колекторот за отпадоци, __halt_compiler() example

<?php

// open this file
$fp = fopen(__FILE__, 'r');

// seek file pointer to data
fseek($fp, __COMPILER_HALT_OFFSET__);

// and output it
var_dump(stream_get_contents($fp));

// the end of the script execution
__halt_compiler(); the installation data (eg. tar, gz, PHP, etc.)

Белешки

Забелешка:

__halt_compiler() претставена во датотеката.

Белешки од корисници Управување со PDO конекции

-T-
12 години пред
This function can be used in eval() -- it will halt the eval, but not the script eval"() was called in.
ravenswd на gmail точка com
пред 15 години
__halt_compiler is also useful for debugging. If you need to temporarily make a change that will introduce an error later on, use __halt_compiler to prevent syntax errors. For example:

<?php
if ( $something ):
  print 'something';
endif;   // endif placed here for debugging purposes
__halt_compiler();
endif;   // original location of endif -- would produce syntax error if __halt_compiler was not there
?>
ravenswd на gmail точка com
пред 10 години
If "__halt_compiler();" appears in a file which is "include"d or "require"d, then the called-in file will be treated as if it physically cuts off at the "__halt_compiler();". In other words, "__halt_compiler();" only affects the physical file it's in, an outer file that pulls it in will continue to execute.
може да се користи само од најоддалечениот опсег.
пред 6 години
Please note that __HALT_COMPILER() must be uppercase if used from a pharstub: https://www.php.net/manual/en/phar.fileformat.stub.php
i_sofer at yahoo dot com
пред 11 години
I don't exactly know what PHP is doing internally but I don't understand the sanity behind how in token_get_all __halt_compiler is handled.

This is actually valid there:
__halt_compiler/**/ /**/ /**/ /**/ /** */();raw

Normally it pops off just any three tokens so you can have even __halt_compiler***, __halt_compiler))), etc in token _get all.

The weird thing is that is also skips T_OPEN_TAG but in the context __halt_compiler runs in this tag should not be posible. Instead it will pick up < and ? as operators and php as a T_STRING.

It ignores the token at any point so this is also valid:
__halt_compiler()/**/ /**/ /**/ /**/ /** */;raw

When I test this with a php file rather than the tokeniser it works the same.

I can only conclude that PHP/__halt_compiler is pretty weird.

I think this is from attempting to weakly imitate the same syntax handling as in functions (I guess you can put comments/whitespace anywhere). I find it annoying and counter productive though.

Even this is valid:
__halt_compiler// comment\n();raw

A general problem that compound matters is that tokenise wont check whether or not syntax is valid (tokens against each other). When running as PHP you must have ();.
alex at 1stleg dot com
пред 11 години
Joey, you're wrong saying that __halt_compiler have strange behavior. This structure works exactly the same as any other build in structure like empty or isset (even similarly to functions; at least in tokenizer level).

About T_OPEN_TAG - after one open tag is present you didn't expect other one in current php code section, so tokenizer try to handle this "thing" in other way and it's perfectly normal...
Krzysiek
пред 11 години
if you find the value of __COMPILER_HALT_OFFSET__ is highly strange. Maybe...

there are some complier optimization tools, like eAccelator(very old). When the program is pre-complied and cached, the __COMPILER_HALT_OFFSET__ will be 0 = =
На оваа страница

Автоматски outline од активната документација.

Насловите ќе се појават тука по вчитување.

Попрегледно читање

Примерите, changelog табелите и user notes се визуелно издвоени за да не се губат во долгата содржина.

Брз совет Користи го outline-от Скокни директно на главните секции од активната страница.
Извор Оригиналниот линк останува достапен Кога ти треба целосен upstream context, отвори го PHP.net во нов tab.