Mega Code Archive

 
Categories / Php / Class
 

__toString( ) set a string value for the object that will be used if the object is ever used as a string

<?     class Cat {             public function _ _toString( ) {                     return "This is a cat\n";             }     }     $toby = new Cat;     print $toby; ?>