Class & Type Casting

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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 ?




-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux