Class & Type Casting

From: Date: Tue, 10 Jun 2008 09:13:09 +0000
Subject: Class & Type Casting
Groups: php.general 
Request: Send a blank email to php-general+get-275168@lists.php.net to get a copy of this message
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 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 ?

« previous php.general (#275168) next »