php object : get value of attribute by computed name
- by groovehunter
hi
simple question -
How do I access an attribute of an object by name, if i compute the name at runtime?
Ie. i loop over keys and want to get each value of the attributes "field_".$key
In python there is getattribute(myobject, attrname)
It works, of course, with eval("$val=$myobject-".$myattr.";");
but IMO this is ugly!!
TIA
florian