Re: Re: hook cast_object handler in userspace

From: Date: Tue, 05 Aug 2003 23:23:15 +0000
Subject: Re: Re: hook cast_object handler in userspace
References: 1 2 3 4 5 6 7 8 9 10 11  Groups: php.internals 
Request: Send a blank email to internals+get-3742@lists.php.net to get a copy of this message
Hi all, SK> Maybe it will be better to have this method in all classes and define SK> default behavior such as existing ( string )$object cast? I guess that using an interface is better. But if the guys here think different I would revert to the patch with no interfaces. AK> According to the current Coding Standard document.. it should be AK> toString() : even though php is not Case-sensitive:).. What about __construct, __destruct and __clone ? Shouldn't it be named __to_string() or __tostring() ? AK> Would be nice to see this work.. In fact, this does work. The method is called to_string(). Two questions: 1) I can't figure out a better name for the interface. Any ideas ? 2) Should all objects implent this method like __construct, __destruct and __clone or should it be left to the user to decide whether the object implements the printable interface or not.(IMHO a prefer the second) Cristiano Duarte. "Alan Knowles" <alan@akbkhome.com> escreveu na mensagem news:3F2F5229.5070004@akbkhome.com... > > > switch/case removed and patch attached. Is it ok? > > Should the method be named "to_string()", "tostring()" or > > "__tostring()" ? > According to the current Coding Standard document.. it should be > toString() : even though php is not Case-sensitive:).. > > Would be nice to see this work.. > > Regards > Alan > > > Do you commit it to CVS ? > > > > Cristiano Duarte > > > > > > > > > -- > Can you help out? > Need Consulting Services or Know of a Job? > http://www.akbkhome.com >

« previous php.internals (#3742) next »