Re: Class & Type Casting

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

 



//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    |
+----------------------------------------+

--
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