Hi Folks I was wondering (mostly because I came across some situations where I need it) if PHP supplies any methods to "bless" an array or object to become some other object. In perl, I can simply do:
my $SomeInstance = bless { item => 'value', 'Item2' => 'value2' }, 'SomeObject'; And then if I decide that $SomeInstance should be an intance of some other object: bless $SomeInstance, 'OtherObject'; In PHP it would be extremely useful for for doing something like this: <?php Class Foo { Load() { ( .. ) } }; Class Bar extends Foo { } $Thing = new Foo(); $Thing->Load(); ?> In Load the object data is loaded from the database, and now imagine one row to contain the subclass this instance of Foo should become. I then would want $Thing to become and thus behave like an instance of Bar (if my database row says so). Hope this message wasn't too confusing ;) Wouter -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php