Not very good at putting this question into words....
I'm using an API to update some customer information
$customer = new Customer();
$customer->first_name = $value;
$customer->update();
The above would update the first_name
, however I'd like to variable where first name is like:
$attribute = 'first_name';
$customer = new Customer();
$customer->$attribute = $value;
$customer->update();`
Which would then reference the public vars in the Customer class.
I want to avoid writing a method(setter) for every attribute.