Can anyone suggest a safe way to set an object's attribute as below. Note: the script doesn't know what attribute is going to be set until $key is cleaned up and assigned to the attribute variable:
$attribute=ereg_replace("$i"," ",$key);
$obj->$attribute=$val;
So, if $key comes in as "age1", then the "age" attribute will be set in the object..
I have already tried variable variables, but no joy and getting grumpy 🙁
Christo