Re: combining two variables to make one???

From: Date: Mon, 22 Dec 2003 14:16:32 +0000
Subject: Re: combining two variables to make one???
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-173152@lists.php.net to get a copy of this message
> <? > $i = 1; > while ($i >= 3) { > $options$i = "result $i"; > } > ?> You want this: ${"$options{$i}"} = "result $i"; For the sake of clarity I typically do something like the following: $i = 1; while ($i >= 3) { $varName = $options . $i; ${$varName} = "result $i"; } Chris

« previous php.general (#173152) next »