On Fri, 17 Oct 2003 10:11:57 +0000, you wrote:

>I'm re-coding a fairly large multi step form which was written with PHP's 
>register globals turned on.  Since upgrading PHP this form has stopped 
>working and needs editting.
>
>Rather than manually changing each var -
>
>$foo   to    $_POST['foo']
>
>(there are simply too many) i'd like to do something like this -
>
>while(list($key, $val) = each($_POST)) eval("\$.$key = 
>stripslashes($value)");
>
>using a loop to create local variables for each variable in the HTTP Post 
>array.

foreach ($_POST as $key => $value) {
    $$key = $value;
}

Something like that should work. But it's equivalent to turning RG on, so
why not just do that? Nothing's going to explode, it's just a language
feature.

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

Reply via email to