Re: Class & Type Casting

From: Date: Tue, 10 Jun 2008 09:42:50 +0000
Subject: Re: Class & Type Casting
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-275169@lists.php.net to get a copy of this message
//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 you a definite answer but presumably it's not calling the constructor when you type cast it. Add a line to your constructor that will show if this is the case. Eg: function __construct($str){
    $this->contents=$str;
    echo "In string_extended constructor...<br />\n";
} -- Richard Heyes In Cambridge or near Liverpool Street station in London? Employ me http://www.phpguru.org/cv +----------------------------------------+ | Access SSH with a Windows mapped drive | | http://www.phpguru.org/sftpdrive | +----------------------------------------+

« previous php.general (#275169) next »