On 13 May 2004 19:52, John Nichel wrote: > 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. > > > > Monty > > > > foreach ( get_defined_vars() as $key => $val ) { > if ( ! preg_match ( > "/_POST|_GET|_COOKIE|_SERVER|_ENV|_FILES|_REQUEST|_SESSION/", $key ) > ) { $user_defined[$key] = $val; > } > }
Ummmm, or even, possibly, if no user variable names begin with _ if ($key{0}!='_') Cheers! Mike --------------------------------------------------------------------- Mike Ford, Electronic Information Services Adviser, Learning Support Services, Learning & Information Services, JG125, James Graham Building, Leeds Metropolitan University, Beckett Park, LEEDS, LS6 3QS, United Kingdom Email: [EMAIL PROTECTED] Tel: +44 113 283 2600 extn 4730 Fax: +44 113 283 3211 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php