Or you could simply use:

  extract($_POST, EXTR_PREFIX_ALL, 'file_');

That does the same thing much quicker.

-Rasmus

On Thu, 23 May 2002, Nick Wilson wrote:

>
> * and then Ford, Mike               [LSS] declared....
> > > Here's the coup:
> > >
> > > I have a bunch of post vars, lets say $red, $green and $blue
> > > I want to loop through the post vars and create a variable callled
> > > $file_red, $file_green and $file_blue
> >
> > Try this (untested!):
> >
> >     foreach($_POST as $key=>$value):
> >         ${"file_$key"} = $value;
> >     endforeach;
>
> Worked a treat, cheers Mike!
> --
> Nick Wilson     //  www.explodingnet.com
>
>
>
>
> ----------------------------------------------------------------------
> gpg: Warning: using insecure memory!
> gpg: Signature made Thu 23 May 2002 10:18:20 AM PDT using DSA key ID 36BA2F9A
> gpg: Good signature from "Nick Wilson (knickerlas) <[EMAIL PROTECTED]>"
> gpg: WARNING: This key is not certified with a trusted signature!
> gpg:          There is no indication that the signature belongs to the owner.
> gpg: Fingerprint: 35DF 412F 4CCD 348D EA12  F134 1E9B EBAD 36BA 2F9A
> ----------------------------------------------------------------------
>


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to