__halt_compiler() – how nuts?
… halts the execution of the compiler. This can be useful to embed data in PHP scripts, like the installation files. Byte position of the data start can be determined by the __COMPILER_HALT_OFFSET__ constant which is defined only if there is a __halt_compiler() presented in the file.
It may or may not be an elegant solution (it’s certainly relatively simple) but it does have a very valid use case – to allow PHP applications which install themselves from a single script, all related pieces (other PHP scripts, CSS, HTML, images, etc.) being packed at the end of the script in a binary form.
The prime example is Ilia’s fudforum – if you download a recent version, you’ll see it makes use of this – simply run the install.php script an it unpacks everything from there. Greg mentioned __halt_compiler as well a while back, in conjunction with all the stuff he’s been doing on phar archives.
Anyway – personally don’t find it so nuts. And consider the opportunities for building job security ;)