dynamically change the name of the php variable

advertisements

I want to do something like this, but smarter.

$armor = $row['armor'];
$elemental_armor = $row['elemental_armor'];
...
$unlock_field=mysql_result($wiki_result_set,$i,"unlock_field");

if ($unlock_field == "armor"){
    $wiki_armor = $armor;
} else if ($unlock_field == "elemental_armor"){
    $wiki_elemental_armor = $elemental_armor;
}

Is something like this possible?

$wiki_{$unlock_field} = {$unlock_field};

Sorry for the potentially simple question. I am admittedly a php novice.


$var = "wiki_{$unlock_field}";
$$var = $unlock_field;