I have an object of class Foo:
class Foo extends Bar { protected $a; protected $b; } $obj = new Foo();
What I want (and have) to d
You can have the class implement the ArrayAccess interface. This will allow you to treat the object like an array without casting and you get total control over how the members are used.