I have an object which contain other objects. I have an array that describes what is the attributes i need to access. The Array can change in size.
My question is how can i access the sub-object attributes using the array?
Code example:
$student = new Student();
$arr = ['Grades', 'Score'];
foreach.... {}
expected result:
$student->$arr[0]->$arr[1];
I need to iterate over the $arr and access the $student sub-object