class toString
<?php class Person { function getName() { return "Joe"; } function getAge() { return 31; } function __toString() { $desc = $this->getName()." (age ". $desc .= $this->getAge().")"; return $desc; } } $person = new Person(); print $person; ?>