Page 1 of 1

Value as variable name [solved]

Posted: Sun Aug 13, 2006 7:02 pm
by KtRhN
I've ever asked myself if it's possible to use the value of an object as a variable name. Something like this:

Code: Select all

$test='abc';
$foo[$test] = 'bla'; // $foo['abc'] = 'bla'
but this doesn't work. is there a solution to solve that problem?

Posted: Sun Aug 13, 2006 7:04 pm
by RobertGonzalez
How is that not working for you? This works all over the place in PHP.

Posted: Sun Aug 13, 2006 7:20 pm
by KtRhN
Thank you very much. I got "Illegal offset type" everytime due to an error of a much more complex statement and thought that that would be the reason. Now it works. :-)