note 58203 deleted from function.include by betz
| From: | betz@php.net | Date: | Thu, 27 Oct 2005 14:12:15 +0000 |
| Subject: | note 58203 deleted from function.include by betz | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-97694@lists.php.net to get a copy of this message | ||
Note Submitter: j.d.
Reason: useless
----
previouse example doesn't work :(
its always writes eval()'d error. (am i stupid, maybe?)
i've tryed some different variations and have found (i think) a problem with different (in
global) types of variables.
i don't think that everyone need to include ALL vars from $_GLOBAL...
in my templates i only use variables with prefix $XT_...bla-bla-bla
so i've "cut" your example to this:
//=============================================
foreach(array_keys($GLOBALS) as $index){
$value=($GLOBALS[$index])?$GLOBALS[$index]:'';
if(substr($index,0,2)=='XT'){ // here you can change to anything you want
eval("global \$$index;");
}
}
//=============================================
this is work ;) (PHP 4.3.10)
p.s. while executing this example on P4 2.6 GHz difference beetween with checking substr() function
is faster (0.005-0.01 sec) than without.