Re: Variables Help
| From: | John Nichel | Date: | Thu, 13 May 2004 18:51:39 +0000 |
| Subject: | Re: Variables Help | ||
| References: | 1 2 3 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-186139@lists.php.net to get a copy of this message | ||
Monty wrote:
Is there any way to get JUST the user-defined variables in PHP? Problem with get_defined_vars() is that it contains everything, including server and environment vars, and there's no easy way to keep just the user-defined vars part of the array created by get_defined_vars. Montyforeach ( get_defined_vars() as $key => $val ) { if ( ! preg_match ( "/_POST|_GET|_COOKIE|_SERVER|_ENV|_FILES|_REQUEST|_SESSION/", $key ) ) { $user_defined[$key] = $val; } } -- John C. Nichel KegWorks.com 716.856.9675 john@kegworks.com