Possible Duplicate:
Get PHP class property by string
Is there a cleaner way to do this? it does not compile
$object1->name = 'my_name';
$object1->address = 'address';
$object2->somefield->($object1->name) = $object1;
it works only if i assign to another variable $object1->name
$object1->name = 'my_name';
$object1->address = 'address';
$temp = $object1->name;
$object2->somefield->$temp = $object1;