note 65363 deleted from language.variables.variable by bjori
| From: | bjori@php.net | Date: | Sat, 29 Apr 2006 15:28:57 +0000 |
| Subject: | note 65363 deleted from language.variables.variable by bjori | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-110097@lists.php.net to get a copy of this message | ||
Note Submitter: stuart at deadbodiesdontdrown dot com
----
i think there was a comment about dynamically globalizing a var, but heres an example of using it
for unsetting array keys.
function unsetkeys($name=FALSE,$keys=FALSE){
global ${$name};
foreach($keys as $key){ unset(${$name}[$key]); }
}
// set an array. blah.
$colors=array('cold'=>'blue', 'warm'=>'yellow',
'blah'='>stupid');
// remove cold and warm
unsetkeys('colors',array('cold','warm'));
// should output "blah => stupid"
print_r($colors);