RE: [PHP] Using Variable Variables from form values inside a func tion

From: Date: Mon, 18 Feb 2002 16:22:14 +0000
Subject: RE: [PHP] Using Variable Variables from form values inside a func tion
Groups: php.general 
Request: Send a blank email to php-general+get-85216@lists.php.net to get a copy of this message
> -----Original Message----- > From: Ron Dyck [mailto:adam@webbtech.net] > Sent: 18 February 2002 13:38 > [... snip working example] > > but, this doesn't: > > function myFunction() { > foreach($_POST as $key=>$value) { > > if (empty($$key)) { > print "empty value $key<br>"; > } > > } > } What's wrong with: if (empty($_POST[$key])): ? This should work whether or not register_globals is switched on, and is therefore much to be preferred. 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: m.ford@lmu.ac.uk Tel: +44 113 283 2600 extn 4730 Fax: +44 113 283 3211

« previous php.general (#85216) next »