__halt_compiler
Interrupt the compiler execution
__halt_compiler()
function is used to stop the compiler's execution.
__halt_compiler ( )
The __halt_compiler()
function is not actually used to stop the compiler in regular PHP scripts. Its main purpose is to use it with the Phar packager. When creating a Phar archive, you can use the __halt_compiler()
function to separate the PHP code from the archived metadata. In this case, nothing after __halt_compiler() is executed as PHP code, but is stored in the metadata archived by Phar. This function itself does not really "stop" the PHP compiler, its name may be a bit misleading. Calling this function in a regular PHP script does not actually have any effect.