> -----Original Message-----
> From: Kevin Stone [mailto:kevin@;helpelf.com]
> Sent: 06 November 2002 18:32
>
> The method that you have described below is going to produce
> a numerical Key
> which is going to result in several errors.
Huh? What on earth does this mean?
> -Kevin
>
> ----- Original Message -----
> From: "Jason Young" <[EMAIL PROTECTED]>
> To: <[EMAIL PROTECTED]>
> Sent: Wednesday, November 06, 2002 10:52 AM
> Subject: [PHP] Code Advice
>
>
> > I (think I) have come up with an interesting little
> solution for pages
> > that have/can potentially have a lot of get vars, and I
> just wanted to
> > throw it by everyone to see if I know what I'm talking about...
> >
> > Instead of having a whole bunch of ...
> > "if (isset($_GET['var']))
> > $var = $_GET['var']"
> > .. lines on top of each page.. does this code look feasable to you?
> >
> > -----
> > $get_allow = array('foo', 'bar', 'add', 'takeovertheworld');
> >
> > while (list($key,$val)=each($get_allow))
> > {
> > if (isset($_GET[$key]))
> > $$key = $val;
> > }
Yes, I suppose this is a step up from extract(). Looks fine to me, except that I'd use
foreach ($get_allow as $key=>$val)
rather than the while() -- comes down to personal preference, I suppose.
Cheers!
Mike
---------------------------------------------------------------------
Mike Ford, Electronic Information Services Adviser,
Learning Support Services, Learning & Information Services,
JG125, James Graham Building, Leeds Metropolitan University,
Beckett Park, LEEDS, LS6 3QS, United Kingdom
Email: [EMAIL PROTECTED]
Tel: +44 113 283 2600 extn 4730 Fax: +44 113 283 3211
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php