为什么有些PHP个对象可以转成字符串

Why can some PHP objects be converted to a string

我正在研究 PHP 整洁,我看到了以下代码

$tidy = new tidy;
$tidy->parseString($html, $config, 'utf8');
$tidy->cleanRepair();
// Output
echo $tidy;

Tidy这里是一个对象。为什么这不引发 Catchable fatal error: Object of class tidy could not be converted to string 错误???

我不熟悉 tidy,但我的猜测是,该对象实现了魔术方法 __toString(),如下所述:http://php.net/manual/en/language.oop5.magic.php#object.tostring