RE: [PHP] Variable variables question?

From: Date: Mon, 16 Jun 2003 13:43:35 +0000
Subject: RE: [PHP] Variable variables question?
Groups: php.general 
Request: Send a blank email to php-general+get-151655@lists.php.net to get a copy of this message
> -----Original Message----- > From: Douglas Douglas [mailto:replaceafill@yahoo.com] > Sent: 14 June 2003 00:57 > > Thanks for the explanation, but I think this is a > different case, isn't? I'm not trying to do this > ${$_POST}, I'm trying to make this string $_POST. Then why not just make it: $var = '$_'.$method; (Forgive me if I've misunderstood and that's not what you mean!) > And I have another question. Why does this code work? > > <?php > echo '<pre>'; > print_r($_POST); > echo '</pre><br><br>'; > $method = 'POST'; > $data = ${'_'.$method}; > echo '<pre>'; > print_r($data); > echo '</pre><br><br>'; > ?> H'mm, interesting -- that does seem to be in contradiction of the Warning I pointed out before. You're definitely using the variable variables trick to access a superglobal! Sorry, I'm stumped on this one... ;( 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 (#151655) next »