Re: [PHP] Class Type Casting

2008-06-11 Thread Leurent Francois
One could ask if it would just pass to the constructor, but it doesn't. I don't know if there's a technical reason for that or if just no one implemented it, but the short answer is The language doesn't do that. That's what i was asking about, when trying to cast something into a non

[PHP] Class Type Casting

2008-06-10 Thread Leurent Francois
I was asking myself if there was a good reason this syntax not to work class string_extented{ function __construct($str){ $this-contents=$str; } function __toString(){ return $this-contents; } } //that's working fine $test= new string_extended(this is my anonymous string); echo $test; /that's

Re: [PHP] Class Type Casting

2008-06-10 Thread Richard Heyes
//that's working fine $test= new string_extended(this is my anonymous string); echo $test; /that's not working, but should'nt it be the case ? $test = (string_extended) This is my anonymous string; echo $test; I'll find this very usefull :x, it's just a syntax ehancement nope ? Can't give

Re: [PHP] Class Type Casting

2008-06-10 Thread Andrew Ballard
On Tue, Jun 10, 2008 at 5:42 AM, Richard Heyes [EMAIL PROTECTED] wrote: //that's working fine $test= new string_extended(this is my anonymous string); echo $test; /that's not working, but should'nt it be the case ? $test = (string_extended) This is my anonymous string; echo $test; I'll

Re: [PHP] Class Type Casting

2008-06-10 Thread Larry Garfield
On Tuesday 10 June 2008, Leurent Francois wrote: I was asking myself if there was a good reason this syntax not to work class string_extented{ function __construct($str){ $this-contents=$str; } function __toString(){ return $this-contents; } } //that's working fine $test= new

Re: [PHP] Class Type Casting

2008-06-10 Thread Nathan Nobbe
On Tue, Jun 10, 2008 at 5:13 AM, Leurent Francois [EMAIL PROTECTED] wrote: I was asking myself if there was a good reason this syntax not to work class string_extented{ function __construct($str){ $this-contents=$str; } function __toString(){ return $this-contents; } } //that's