Re: q: extract() and get_defined_vars()
| From: | David Nicholson | Date: | Sat, 28 Jun 2003 01:06:54 +0000 |
| Subject: | Re: q: extract() and get_defined_vars() | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-153239@lists.php.net to get a copy of this message | ||
Hello,
This is a reply to an e-mail that you wrote on Sat, 28 Jun 2003 at 02:01,
lines prefixed by '>' were originally written by you.
> Pretty sneaky. But at this point, why bother with the extract() at
> all?
> wouldn't this do the same thing:
> function Foo(){
> $theArray = array('var1'=>'testing',
> 'var2'=>'testing2');
> foreach($theArray as $varname=>$value){
> $GLOBALS[$varname] = $value;
> }
> Which is what I am already doing...
Yes, good point. Also that avoids using variable variables which produces
much easier to read code.
David.
--
phpmachine :: The quick and easy to use service providing you with
professionally developed PHP scripts :: http://www.phpmachine.com/
Professional Web Development by David Nicholson
http://www.djnicholson.com/
QuizSender.com - How well do your friends actually know you?
http://www.quizsender.com/
(developed entirely in PHP)