Re: [PHP] extract() question

2001-11-19 Thread Jason G.
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

Re: [PHP] extract() question

2001-11-18 Thread Joe Stump
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; } } } ?