View Single Post
Old 06-26-2009, 10:19 AM   #7 (permalink)
Hades
Moderator
 
Hades's Avatar
 
Join Date: 01-23-07
Location: Buenos Aires, Argentina
Posts: 1,223
iTrader: 0 / 0%
Hades is a web professional of the highest orderHades is a web professional of the highest orderHades is a web professional of the highest orderHades is a web professional of the highest orderHades is a web professional of the highest orderHades is a web professional of the highest orderHades is a web professional of the highest orderHades is a web professional of the highest orderHades is a web professional of the highest orderHades is a web professional of the highest orderHades is a web professional of the highest order
I would roll through the globals checking if your exclusion variables are there and creating a temp. array, and after that replace $GLOBALS with the temp.

PHP Code:
function exclude_globals($exclude NULL){
    
    
//default exclusions
    
$default_excludes = array("_POST","_GET");
    
    
//roll through $GLOBALS
    
$GLOBALS_temp=array();
    foreach(
$GLOBALS as $GLOBALS_name=>$GLOBALS_content){
        
        
//check if vars are in global
        
if (!(in_array($GLOBALS_name,$exclude) || in_array($GLOBALS_name,$default_excludes)) ){
            
            
//assign to temp array
            
$GLOBALS_temp[$GLOBALS_name]=$GLOBALS_content;
        }
        
    
//replace globals with temp array
    
$GLOBALS $GLOBALS_temp;
    }
    
}

//call the function
exclude_globals(array("_FILES"));

//dump GLOBALS
echo("<h2>glob</h2>");
echo(
"<pre>");
print_r($GLOBALS);
echo(
"</pre>"); 
That takes away those variables from $GLOBALS but I'm not sure if that's exactly what you want
__________________
Hades,
Ancient god, King of the Nether World, and Guardian of the Dead.
...and on my free time I'm also a web developer, contact me if you need one!
Hades is offline   Reply With Quote