RE: [PHP] Calling a Variable in a weird Way

From: Date: Thu, 07 Mar 2002 13:05:01 +0000
Subject: RE: [PHP] Calling a Variable in a weird Way
Groups: php.general 
Request: Send a blank email to php-general+get-87613@lists.php.net to get a copy of this message
> -----Original Message----- > From: Phillip S. Baker [mailto:phillip@freewolf.net] > Sent: 07 March 2002 05:52 > > for ($i=1; $i < 12; $i++) { > echo state_$i; // This would print out either Yes No or Maybe. > } Close -- it's actually: echo ${"state_$i"}; (For the record, these are called "variable variables", and are documented at http://www.php.net/manual/en/language.variables.variable.php). 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 (#87613) next »