Re: Variables in variable names

From: Date: Wed, 09 May 2001 11:40:39 +0000
Subject: Re: Variables in variable names
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-52081@lists.php.net to get a copy of this message
At 09.05.01 23:08, you wrote:
Hello, I need some help (newbie). I have some variable names with the form: $name_1 $name_2 $name_3 $name_4... I want to access them by doing something like this: $i=0 $name_$i This doesn't work, how do I include another variable in the name of a variable?. What you´re looking for is variable variables, Try this:
for ($i=0; $i < $max_var_count;$i++) {
        $tmp="name_".$i;
        $show_var_name_content=$$tmp;
} THT Oliver

« previous php.general (#52081) next »