dynamic object members
Posted: Sun Jan 16, 2011 4:11 pm
I store locations of values in relation to its containing object(s) in a database. Question is, what is the best way to do something like below.
$var = "vendor->member->name"; // stored location in database
$invoice = new Invoice(); //I have an object that contains the vendor object and the vendor object contains the member object and so on.
So Im trying to do something like the following
$invoice->$var // which I would hope to be the same as $invoice->vendor->member->name;
any ideas?
$var = "vendor->member->name"; // stored location in database
$invoice = new Invoice(); //I have an object that contains the vendor object and the vendor object contains the member object and so on.
So Im trying to do something like the following
$invoice->$var // which I would hope to be the same as $invoice->vendor->member->name;
any ideas?