class Foo { public function __toString() { return "Some text about the OBJECT"; } } $foo = new Foo(); echo $foo;
__toString
Pro tip: use ```triple backticks around text``` to write in code fences