I was googling and reading the manual, but couldn't find an answer.
Ie, have an array of strings like this:
$a = ['book->name', 'book->id'];
Now I need to get those values from shelf object. Normaly I would just ask:
$bookName = $shelf->book->name;
$bookId = $shelf->book->id;
But how do I read with the 2nd part beeing a string?
If I try $shelf->{$a[0]} I get Undefined property: stdClass::$book->name in....
What is the way to solve this?
PS: I know I can try eval, but would really like not to.