This method is called by
var_dump()
when dumping an object to get the properties that should be shown. If the method isn't defined on an object, then all public, protected and private properties will be shown. — PHP Manual
class DeepThought {
public function __debugInfo() {
return [42];
}
}
var_dump(new DeepThought());
The above example will output:
class DeepThought#1 (0) {
}
var_dump(new DeepThought());
The above example will output:
class DeepThought#1 (1) {
public ${0} =>
int(42)
}