Re: a value of variable as a name of variable

From: Date: Thu, 16 Nov 2000 07:49:12 +0000
Subject: Re: a value of variable as a name of variable
Groups: php.general 
Request: Send a blank email to php-general+get-25647@lists.php.net to get a copy of this message
If I understand you correctly, you want the value of $weight, which is referred to in $quantity[1]. All you need to do is add a $ infront of the variable, but for the case of $quantity[1], you need to enclose it with {} because the compiler doesn't if you want $weight[1] or $weight ie. ${$quantity[1]} will be the same as $weight and ${$quantity}[1] will be $weight[1] if $quantity is equal to 'weight'. Refer to http://www.php.net/manual/language.variables.variable.php Robin petr.juza@worldonline.cz wrote: > > I have variable with this value: > $quality[1]="weight"; > $vl_hod="$quality[1]"; > > And I want use the value(!!) of variable $vl_hod as a name of > variable for the next use. Is it possible to do it? > > For example: > ???echo $vl_hod;???? > I want that the output of "echo" was the value "weight" and > no the value "$quality[1]". > > Please, can somebody help me? > > Thank you very much? > > ------------------------------------------------- > Tento e-mail byl odeslán ze serveru www.worldmail.cz > > -- > 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 (#25647) next »