>Hi,
>
>I've got a little problem with variable naming of object members. Here is my
>situation: I've got a website form, whoms contents will be saved in a MySQL
>table with two fields: name and value. The name could be anything like
>"bla->test", "array[3]->test[4]->name"...
>
>Now I have a php script reading out the MySQL table, and I want to assign
>the variables like this:
>$object->$name, i.e.
>$object->bla->test = "some value";
>$object->array[3]->tes[4]->name = "some other value"; etc.
>
>Using $object->$name doesn't work, as this seems to ignore submembers and
>arrays.
>Any ideas how to solve my problem?

You might try:

$object->{$name} = "some value";

If all else fails, you could probably dink around with http://php.net/eval
and get what you want.

-- 
Like Music?  http://l-i-e.com/artists.htm


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to