Raditha Dissanayake wrote: > Hi Wouter, > > Wouter van Vliet wrote: > >> 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: (..) >> > > I suspect that the reason that you find bless in perl is > because it's OO foundations are not as strong as even that of > PHP. Well PHP's OO foundations are weak enough. :-) > > The specific scenario you have described can IMHO be achieved > with the use of serialize / deserialize.
Hmm, seriailze and deserialize.. Don't think that's what I would want to do. You probably mean that I can serialize an object, hack the string to change the Class reference. That's not really what I want to do. Right now I'm hacking through it by *) Creating a new instance of the desired class ($New = new OtherClass()) *) Copy all attributes (foreach($this as $Key=>$Value) $New[$Key] = $Value) *) Replace the "$this" var ($this = $New) Not the best solution, I now .. But it works, currently. Please, there must be another way to do this ! Wouter -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php