Making a variable out of another variables' value in php (php basics)
I need to make a dynamic variab开发者_JAVA百科le based on a loop, what i am looking for is a variable something like
$var = "foo";
$$var = "bar";
echo $foo; // bar
but for me it should be more like a fixed parameter attached to the dynamic part like
$var='123';
$'current_'.$$var=some value; // not correct syntax
echo $current_123 should give 'some value';
Use curly braces:
$${'current_' . $var} = $some_value;
精彩评论