Re: VariableName

From: Date: Thu, 24 May 2001 12:08:23 +0000
Subject: Re: VariableName
References: 1 2  Groups: php.general 
Request: Send a blank email to php-general+get-54209@lists.php.net to get a copy of this message
Very nice solution. Thank you ! Plutarck schrieb: > If the variable's names will be $Name1, $Name2, etc, then you'd do something > like this: > > for ($i = 1, $i <= $n) > { > /* $n will be how many variables you have. So if you have 5 variables, $n > should equal 5 */ > ${"Name" . $i} = $default_value; > } > > So if $n was 3 and $default_value was 0, you'd have three variables who's > value was 0: > $Name1 > $Name2 > $Name3 > > Variable variables are the way to go. They're so cool :) I wonder if Java > has anything like that... > > Plutarck > > "Martin Thoma" <martin@radiok2r.de> wrote in message > news:3B0CF41B.BC726151@radiok2r.de... > > Hello ! > > > > I want to make a dynamic formular, on which the user can enter a > > different number of names. > > So to make the form I do: > > > > for ($i = 0; $i < $anzahl; $i++) > > { printf ("<INPUT TYPE=\"TEXT\" NAME=\"Name%.0d\" > > VALUE=\"\" > > SIZE=20\">\n", $i); > > } > > > > Now I want to set all the Varables Name0, Name1, Name2 etc. to a > > default-value. > > How can I do it in a for-next-loop ? > > > > Regards > > > > Martin > > > > > > > > -- > > PHP General Mailing List (http://www.php.net/) > > To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net > > For additional commands, e-mail: php-general-help@lists.php.net > > To contact the list administrators, e-mail: php-list-admin@lists.php.net > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net > For additional commands, e-mail: php-general-help@lists.php.net > To contact the list administrators, e-mail: php-list-admin@lists.php.net

« previous php.general (#54209) next »