You needn't, in fact, mess with eval() at all if you don't want to. OMG! TMTWODI! In PHP!!! =)
$foo = "bar";
$bar = "baz";
print $$foo; // prints "baz"
print ${$foo}; // also prints "baz"
You might need the second sort of syntax if you are going to use $$foo within, say double quotes (the curly braces disambiguate).
Similarly, you could load up an array like this:
$bgtype = array ("type1", "type2");
$type0= "foo";
$type1="bar";
foreach ($bgtype as $this_one) {
print $$this_one . "\n";
}
// prints "foo\nbar\n"
HTH,
AC