开发者

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;
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜