Welcome to HBH! If you have tried to register and didn't get a verification email, please using the following link to resend the verification email.

Creating multiple variables in PHP


ghost's Avatar
0 0

system_meltdown wrote: [quote]Mr_Cheese wrote: [quote] for ( $i = 0; $i <= 10; $i++ ){ eval("$" . $i = $i); }

Use the double dollar variable thingy.

for ( $i = 0; $i &lt;= 10; $i++ ){
$$i = $i;
}

this is used to make variable values… variables.. make sense?

$admin = "foo";

$$admin = "bar";

then… you can do: echo $foo, outputs "bar"

make sense? [/quote]

Variables cannot start with an integer therefore this won't work, because you can't do: echo $1 or anything of the like.[/quote]

Well, it's already been determined that an array would be friendlier… but, to get around the variable naming issue… use $$chr($i+65). 65-90 is the range for ASCII A-Z.

Bump.