Skip to content

Latest commit

 

History

History
13 lines (11 loc) · 262 Bytes

toString.md

File metadata and controls

13 lines (11 loc) · 262 Bytes

toString

__toString() allows you to 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;
echo $toby;