[PHP] Re: "Bless"ing an object

2003-11-28 Thread Greg Beaver
Hi Wouter, The only disadvantage to assigning to $this is that it may not be supported in PHP 5 - php-internals discussion has described it as a bad idea. I would get beta 2 and test it out, see what happens. Incidentally, you don't need to unset new, and I would use $this =& $New; Regards,

[PHP] RE: "Bless"ing an object

2003-11-28 Thread Wouter van Vliet
Greg Beaver wrote: > Wouter, > > you could try this adding this method to each object you need > blessings from: > > function &bless($classname) > { > if ($classname == get_class($this)) { > return $this; > } > $vars = get_object_vars($this); > $ret = new $classname;

RE: [PHP] Re: "Bless"ing an object

2003-11-27 Thread Wouter van Vliet
[EMAIL PROTECTED] wrote: > Hello > > Just out of curiosity why do you need such a function? I'm no > perl programmer and have very little knowledge of the > language ... yet ; ) but the way you describe it it seems to > me that you have a fundamentle design flaw in your script if > you need to ch

[PHP] Re: "Bless"ing an object

2003-11-27 Thread SLanger
Hello Just out of curiosity why do you need such a function? I'm no perl programmer and have very little knowledge of the language ... yet ; ) but the way you describe it it seems to me that you have a fundamentle design flaw in your script if you need to change types on the fly that are in no

[PHP] Re: "Bless"ing an object

2003-11-26 Thread Greg Beaver
Wouter, you could try this adding this method to each object you need blessings from: function &bless($classname) { if ($classname == get_class($this)) { return $this; } $vars = get_object_vars($this); $ret = new $classname; return $ret->loadValues($vars); } function