Source Code:
(back to article)
<?php class Cups { public function __toString() { return 'Ninety nine green cups'; } } $ex = new Cups(); var_dump($ex, (string) $ex); // Returning: the instance of Cups and "Ninety nine green cups"
Result:
Report an issue