I needed this once, but I could not figure out how to just create the vars
in current scope.
If my_extract() is called from within a function, then the variables will
not be available unless you declare them global (which kinda makes the
function pointless).
Any ideas?
-Jason Garber
You may want to do something like this instead:
?
function my_extract($arr)
{
if(is_array($arr) sizeof($arr))
{
while(list($key,$val) = each($arr)
{
$new_var = str_replace(' ','_',$key);
global $$new_var;
$$new_var = $val;
}
}
}
?
2 matches
Mail list logo