note 1611 deleted from language.variables.variable by alindeman
| From: | alindeman@php.net | Date: | Thu, 08 May 2003 02:01:41 +0000 |
| Subject: | note 1611 deleted from language.variables.variable by alindeman | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-47663@lists.php.net to get a copy of this message | ||
[Ed: You're now using the (indeed yet undocumented) ${expression} syntax]
Creating variable variables on the fly..
I had a problem I needed to get "n" variables named
"x_1, x_2 .... x_n".
To do this when n is passed as a parameter I used a little (undocumented?) trick.
for($i=0;$i<$n;$i++){
$finalvar=${"x_$i"}; /* this is the trick! */
}