Re: How to apply something to every variable
| From: | Chris Anderson | Date: | Fri, 06 Jul 2001 23:06:27 +0000 |
| Subject: | Re: How to apply something to every variable | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-56588@lists.php.net to get a copy of this message | ||
Fine, just outdo me =)
----- Original Message -----
From: "Chadwick, Russell" <rchadwick@miva.com>
To: <php-general@lists.php.net>
Sent: Friday, July 06, 2001 6:10 PM
Subject: RE: [PHP] How to apply something to every variable
>
> while (list($key, $val) = each ($HTTP_POST_VARS)) {
> ${$key} = addslashes($val);
> }
>
> - Russ
>
> -----Original Message-----
> From: Chris Anderson [mailto:chrisderson@ameritech.net]
> Sent: Friday, July 06, 2001 3:07 PM
> To: php-general@lists.php.net
> Subject: [PHP] How to apply something to every variable
>
>
> I was playing around trying to find a way to addslashes() to all my
> variables, and I came up with this snippet. Hope it helps someone
>
> $keys = array_keys($HTTP_POST_VARS);
> $post_size = sizeof($keys);
> for($x = 0; $x < $post_size; $x++)
> {
> $temp = $keys[$x];
> //you can replace addslashes with whatever you want to use
> ${"$temp"} = addslashes($HTTP_POST_VARS["$temp"]);
> }
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net
> For additional commands, e-mail: php-general-help@lists.php.net
> To contact the list administrators, e-mail: php-list-admin@lists.php.net
>