note 79129 added to function.halt-compiler

From: Date: Tue, 13 Nov 2007 04:55:33 +0000
Subject: note 79129 added to function.halt-compiler
Groups: php.notes 
Request: Send a blank email to php-notes+get-132215@lists.php.net to get a copy of this message
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). ---- Server IP: 64.71.164.2 Probable Submitter: 71.92.131.234 ---- Manual Page -- http://www.php.net/manual/en/function.halt-compiler.php Edit -- https://master.php.net/note/edit/79129 Del: integrated -- https://master.php.net/note/delete/79129/integrated Del: useless -- https://master.php.net/note/delete/79129/useless Del: bad code -- https://master.php.net/note/delete/79129/bad+code Del: spam -- https://master.php.net/note/delete/79129/spam Del: non-english -- https://master.php.net/note/delete/79129/non-english Del: in docs -- https://master.php.net/note/delete/79129/in+docs Del: other reasons-- https://master.php.net/note/delete/79129 Reject -- https://master.php.net/note/reject/79129 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#132215) next »