note 83597 deleted from function.halt-compiler by googleguy
| From: | googleguy@php.net | Date: | Tue, 22 Oct 2013 11:00:51 +0000 |
| Subject: | note 83597 deleted from function.halt-compiler by googleguy | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-197014@lists.php.net to get a copy of this message | ||
Note Submitter: gn_shallyNOSPAM at yahoo dot com
----
actually, __halt_compiler did something, even in eval function, that things is set the constant
__COMPILER_HALT_OFFSET__ to the right value
as all of you might know, PHP will change content of some magic constant like __FUNCTION__,
__CLASS__, etc based on the situation. so do the __COMPILER_HALT_OFFSET__ constant, is a file
specific constant, just like the __FILE__ constant, the content will be changed based on wich file
the __halt_compiler() reside.
try this:
/**** whatever.php ****/
<?php
eval('echo __FILE__."(".__COMPILER_HALT_OFFSET__.")\n";
__halt_compiler();');
echo __FILE__."(".__COMPILER_HALT_OFFSET__.")\n"; __halt_compiler();
if (!isset($whatever))
{
$whatever = 'whatever';
include __FILE__;
}
__halt_compiler();whatever