and that's pretty cool ... do you also have a solution to access the name of this "dynamic" variable if I'd like to use it also (e.g. with WDDX functions)? That' would be great! TIA, Arne > -----Original Message----- > From: ..s.c.o.t.t.. [gts] [mailto:[EMAIL PROTECTED]] > Sent: Thursday, May 10, 2001 5:07 PM > To: Php-General > Subject: RE: [PHP] if $index=1 how can I create a variable named > $column_1 > > > And even though it's much less elegant than the > solution by Sean below, you could also use 'eval' > > $toast = array("wheat", "rye", "pumpernickel"); > $numbreads = count($toast); > for ($index = 0; $index < $numbreads; $index++) { > eval("\$column$index = '$toast[$index]'; > echo \$column$index . '<BR>';") ; > } > > > -----Original Message----- > > From: Sean R. Bright [mailto:[EMAIL PROTECTED]] > > To: 'Jay Lepore'; [EMAIL PROTECTED] > > Subject: RE: [PHP] if $index=1 how can I create a variable named > > > > $toast = array("wheat", "rye", "pumpernickel"); > > $numbreads = count($toast); > > for ($index = 0; $index < $numbreads; $index++) { > > ${"column" . $index} = $toasts[$index]; > > } > > > > (A little less code and one less variable required.) > > > > Sean > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP] if $index=1 how can I create a variable named $column_1
Arne Borkowski \(borko.net\) Fri, 11 May 2001 11:06:33 -0700
- [PHP] if $index=1 how can I create a variable... Jay Lepore
- RE: [PHP] if $index=1 how can I create a... Sean R. Bright
- RE: [PHP] if $index=1 how can I crea... Sean R. Bright
- RE: [PHP] if $index=1 how can I ... ..s.c.o.t.t.. [gts]
- Re: [PHP] if $index=1 how ca... Arne Borkowski \(borko.net\)
- Re: [PHP] if $index=1 how can I create a... Paul Kozlenko
- Re: [PHP] if $index=1 how can I crea... Paul Kozlenko