I saw a sample code of a PayPal document before, and I added echo directly in front of the class object, and actually printed a bunch of strings.
It turns out that __toString can be processed. When an object is treated as a string, this method will be called.
class A{
function __toString(){
return "我输出了字符串";
}
}
$a=new A();
echo $a;