Question: I am new to PHP and I am trying to set multiple parameters to the same value.
I have done it the (probably) ugly way.

```
$thpic0 = "thpic_dummy";
$thpic1 = "thpic_dummy";
$thpic2 = "thpic_dummy";
$thpic3 = "thpic_dummy";
etc...
$thpic13 = "thpic_dummy";
$thpic14 = "thpic_dummy";

```

Since the only char changing is the last char in the parameters I thaught it could be done in a for-loop, but this (obviously) does not work:

```
//Reset th sorting pics
for($i=0;$i<=14;$i++)
{
$thpic{$i} = "thpic_dummy";
}

```

Is there another way I can do this without too many lines of code?

Answer: 
The correct syntax is `${…}` instead of `$…{…}`:

```
${"thpic$i"} = ...;

```

would be the valid syntax.

Some further PHP manual lecture about this: <http://php.net/language.variables.variable.php>
You can use variable-variables to achieve what you want:

```
for($i=0;$i<=14;$i++)
{
    $variable  = 'thpic' . $i;
    $$variable = "thpic_dummy";
}

```

You can read more about these in the docs: <http://php.net/manual/en/language.variables.variable.php>

Alternatively, you can use the syntax: `${"thpic" . $i} = "thpic_dummy";`