- serialize: documentation ( source)
<?php
class HelloWorld {
public function __toString() {
return serialize($this);
}
}
$reflectionMethod = new ReflectionMethod('HelloWorld', '__toString');
echo $reflectionMethod->invokeArgs(new HelloWorld(), array());
?>