I need a function that give an instance and a dot notation string and return its equivalent object. Something like this
public function convert($instance , $str) {
//If $str = 'instance' return $instance
//If $str = 'instance.name' return $instance->name
//If $str = 'instance.member.id' return $instance->member->id
//...
}
How can I do this