PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
I want to access part of a class dynamically(the portion of the class is determined at run time). I cant get eval to give me the right answer and I though I could just use the code bellow. But is not working. Any ideas?
$field_array = array(
'FIELD1'=>'customer->name',
'FIELD2'=>'car->insurance->debt->number'
);
imagine that I have classes that match the above path. then in my code I could do
$field = $field_array['FIELD1'];
echo $this->data->$field;
Since there could be objects inside objects, I need to be able to use the arrow(->)