Re: using array to declare globals in function?

From: Date: Mon, 27 May 2002 06:27:37 +0000
Subject: Re: using array to declare globals in function?
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-99340@lists.php.net to get a copy of this message
On Saturday 25 May 2002 05:21, Jeff Field wrote: > Anyone know how to declare globals in a function from an array? The > following doesn't seem to work: > > foreach($_POST as $key => $value) > global $form_var[$key]; Not sure what you're trying to do. If you're trying to extract all the values in $_POST so that they're available in the global scope then try: foreach($_POST as $key => $value) $GLOBALS[$key] = $value; } also look at extract(). -- Jason Wong -> Gremlins Associates -> www.gremlins.com.hk Open Source Software Systems Integrators * Web Design & Hosting * Internet & Intranet Applications Development * /* A fail-safe circuit will destroy others. -- Klipstein */

« previous php.general (#99340) next »