Re: accessing $HTTP_POST_VARS in user-defined function
| From: | Jason Wong | Date: | Tue, 06 Aug 2002 20:57:18 +0000 |
| Subject: | Re: accessing $HTTP_POST_VARS in user-defined function | ||
| References: | 1 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-21021@lists.php.net to get a copy of this message | ||
On Wednesday 07 August 2002 04:48, Rob Day wrote:
> I'm trying to use $HTTP_POST_VARS from within a user-defined function.
> Currently I'm just passing the array to the function like so:
>
> MyFunction($HTTP_POST_VARS);
>
> function MyFunction($VARS)
> {
> blah, blah, blah....
> }
>
> This doesn't seem like the best way to me. I imagine that this could slow
> things down - especially when I'm passing that array to several functions.
> Is there a way to access them directly from the function without passing
> the array? Something else maybe? Thanks.
> -Rob <rday@tsl.state.tx.us>
function MyFunction($VARS)
{
echo $GLOBALS['HTTP_POST_VARS']['myvar'];
blah, blah, blah....
}
OR
function MyFunction($VARS)
{
global $HTTP_POST_VARS;
echo $HTTP_POST_VARS['myvar'];
blah, blah, blah....
}
--
Jason Wong -> Gremlins Associates -> www.gremlins.com.hk
Open Source Software Systems Integrators
* Web Design & Hosting * Internet & Intranet Applications Development *
/*
The fact that boys are allowed to exist at all is evidence of a remarkable
Christian forbearance among men.
-- Ambrose Bierce
*/