I know I can generate a class at runtime by executing
$obj = (object)array('foo' => 'bar');+
this way I can use
echo $obj->foo; //bar
What if want to make $obj inherits from an existing class?
What I wanna achive: I'm forking paris project on github (https://github.com/balanza/paris). It's an active record class. I wonder I need to declare a class for every object, even if it's empty:
class User extends Model{}
I guess I might use dynamic object to avoid this boring stuff.
Strictly to your question, the only way I can see it possible is by using Runkit, which let's you re-declare classes on the fly. Not sure how portable that solution is.