Hi There,

I just got a chance tp update to PHP5 RC1 and noticed that some things
have changed for the __toString method. It seems that it it only getting
called when the object is printed or echo. Casting the object to a string
returns the Object #. Here is an example:



---- The Script:

<?php

class obj
{
        function __toString()
        {
                return "yo!!\n";
        }
}

$obj = new obj();
print_r($obj);

$test = (string) $obj;

print $test;
print $obj;

?>

----- Produces:

obj Object
(
)
Object id #1yo!!



Thanks,
David

-- 
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to