note 79129 deleted from function.halt-compiler by nlopess

From: Date: Fri, 16 Nov 2007 11:27:05 +0000
Subject: note 79129 deleted from function.halt-compiler by nlopess
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-132343@lists.php.net to get a copy of this message
Note Submitter: zabmilenko at charter dot net ---- Most examples of __halt_compiler() that I have found online are related to setup packages (stashing tar/zip data at the end of a script file). The __halt_compiler() construct can be used near the top of a PHP script in a sort of "double-preprocessing" trick. Try this example on a unix-compatible system with the gnu cpp utility installed: <?php #define __CPP__ true #ifndef __CPP__ $tmp_file = __FILE__ . "c"; if (filemtime(__FILE__) > filemtime($tmp_file)) { exec("cpp -E -Wp,-w,-P " . __FILE__ . " -o " . $tmp_file); } include($tmp_file); __halt_compiler(); #endif // Your Code Here ?> A discussion and example can be found at http://wickedphp.net/cpp.html (permanent link).

« previous php.notes (#132343) next »