Jump to content

Most obsure and hard to use core function?


tibberous

Recommended Posts

I while ago I would have said variable variables. Now I'm going with:

 

__halt_compiler

 

Seriously, has anyone ever used this? I read the docs for five minutes and still don't know what it does or when I would ever use it. Variable variables are at least useful, just kind of hard to explain.

No, it's perfectly named. It halts the compiler, so you can insert arbitrary data after it. It also defines a constant which corresponds to the line number the compiler is halted at. I think the example from the manual is pretty clear about it:

 

<?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.)

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.